mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-21 18:44:19 +00:00
Fix a couple broken imports
This commit is contained in:
parent
74cefd5438
commit
fd4bfeb193
6 changed files with 15 additions and 19 deletions
|
@ -19,7 +19,6 @@ pub struct BroochMatch {
|
|||
impl BroochMatch {
|
||||
pub fn is_flagged(database: &mut PgConnection, match_id: DotaMatchId) -> AnyResult<bool> {
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
use schema::brooch_match;
|
||||
|
||||
log::trace!("Checking if {match_id:?} is flagged...");
|
||||
|
||||
|
@ -35,7 +34,6 @@ impl BroochMatch {
|
|||
|
||||
pub fn flag(database: &mut PgConnection, match_id: DotaMatchId) -> AnyResult<Self> {
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
use schema::brooch_match;
|
||||
|
||||
log::debug!("Flagging {match_id:?} as parsed...");
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Context;
|
||||
use diesel::{AsExpression, FromSqlRow, Identifiable, Insertable, PgConnection, Queryable, QueryId, Selectable};
|
||||
use diesel::{Identifiable, Insertable, PgConnection, Queryable, Selectable};
|
||||
use diesel::deserialize::FromSql;
|
||||
use diesel::pg::{Pg, PgValue};
|
||||
use diesel::pg::Pg;
|
||||
use diesel::serialize::ToSql;
|
||||
|
||||
use crate::newtype_sql;
|
||||
|
@ -21,6 +21,8 @@ pub struct MatchmakingEvent {
|
|||
impl MatchmakingEvent {
|
||||
/// Create a new [MatchmakingEvent].
|
||||
pub fn create(database: &mut PgConnection, text: &str, starts_at: &chrono::DateTime<chrono::Local>) -> AnyResult<Self> {
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
insert_into(matchmaking_events::table)
|
||||
.values(&(
|
||||
matchmaking_events::text.eq(text),
|
||||
|
@ -32,6 +34,8 @@ impl MatchmakingEvent {
|
|||
|
||||
/// Retrieve a [MatchmakingEvent] from the database, given its [MatchmakingId].
|
||||
pub fn get(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Self> {
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
matchmaking_events::table
|
||||
.filter(matchmaking_events::id.eq(matchmaking_id.0))
|
||||
.get_result::<Self>(database)
|
||||
|
|
|
@ -20,26 +20,22 @@ pub struct MatchmakingMessageTelegram {
|
|||
|
||||
#[cfg(feature = "service_telegram")]
|
||||
pub(crate) mod telegram_ext {
|
||||
use std::cmp::Ordering;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
||||
use anyhow::Context;
|
||||
use chrono::DateTime;
|
||||
use chrono::Local;
|
||||
use diesel::PgConnection;
|
||||
use teloxide::payloads::EditMessageTextSetters;
|
||||
use teloxide::payloads::SendMessageSetters;
|
||||
use teloxide::requests::Requester;
|
||||
use teloxide::types::ParseMode;
|
||||
|
||||
use matchmaking_messages_telegram::star;
|
||||
|
||||
|
||||
use crate::interfaces::database::models::{MatchmakingChoice, MatchmakingId, MatchmakingReply, RoyalnetUser, TelegramUser};
|
||||
use crate::utils::anyhow_result::AnyResult;
|
||||
use crate::utils::telegram_string::TelegramEscape;
|
||||
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum MatchmakingTelegramKeyboardCallback {
|
||||
Yes,
|
||||
|
@ -106,8 +102,7 @@ pub(crate) mod telegram_ext {
|
|||
impl MatchmakingMessageTelegram {
|
||||
/// Get all the [MatchmakingMessageTelegram] for a specific [MatchmakingId].
|
||||
pub fn get_all(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Vec<Self>> {
|
||||
use diesel::prelude::*;
|
||||
use crate::interfaces::database::schema::matchmaking_messages_telegram;
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
matchmaking_messages_telegram::table
|
||||
.filter(matchmaking_messages_telegram::matchmaking_id.eq(matchmaking_id.0))
|
||||
|
|
|
@ -27,7 +27,7 @@ pub struct MatchmakingReply {
|
|||
|
||||
impl MatchmakingReply {
|
||||
pub fn get_all_telegram(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Vec<(Self, RoyalnetUser, TelegramUser)>> {
|
||||
use schema::{matchmaking_replies, telegram, users};
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
matchmaking_replies::table
|
||||
.filter(matchmaking_replies::matchmaking_id.eq(matchmaking_id))
|
||||
|
@ -38,7 +38,7 @@ impl MatchmakingReply {
|
|||
}
|
||||
|
||||
pub fn set(database: &mut PgConnection, matchmaking_id: MatchmakingId, user_id: RoyalnetUserId, choice: MatchmakingChoice) -> AnyResult<Self> {
|
||||
use schema::matchmaking_replies;
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
insert_into(matchmaking_replies::table)
|
||||
.values(&Self {
|
||||
|
@ -58,7 +58,7 @@ impl MatchmakingReply {
|
|||
}
|
||||
|
||||
pub fn add_late_minutes(database: &mut PgConnection, matchmaking_id: MatchmakingId, user_id: RoyalnetUserId, increase_by: i32) -> AnyResult<Self> {
|
||||
use schema::matchmaking_replies;
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
insert_into(matchmaking_replies::table)
|
||||
.values(&Self {
|
||||
|
|
|
@ -125,7 +125,7 @@ pub async fn handler(bot: &Bot, message: &Message, args: &DiarioArgs, database:
|
|||
};
|
||||
|
||||
let entry = {
|
||||
use schema::diario;
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
|
||||
insert_into(diario::table)
|
||||
.values(&(
|
||||
|
|
|
@ -8,7 +8,6 @@ use crate::utils::anyhow_result::AnyResult;
|
|||
impl RoyalnetUser {
|
||||
pub fn from_telegram_userid(database: &mut PgConnection, user_id: UserId) -> AnyResult<Self> {
|
||||
use crate::interfaces::database::query_prelude::*;
|
||||
use schema::{telegram, users};
|
||||
|
||||
log::trace!("Retrieving RoyalnetUser with {user_id:?}");
|
||||
|
||||
|
|
Loading…
Reference in a new issue