mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-22 02:54:21 +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 {
|
impl BroochMatch {
|
||||||
pub fn is_flagged(database: &mut PgConnection, match_id: DotaMatchId) -> AnyResult<bool> {
|
pub fn is_flagged(database: &mut PgConnection, match_id: DotaMatchId) -> AnyResult<bool> {
|
||||||
use crate::interfaces::database::query_prelude::*;
|
use crate::interfaces::database::query_prelude::*;
|
||||||
use schema::brooch_match;
|
|
||||||
|
|
||||||
log::trace!("Checking if {match_id:?} is flagged...");
|
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> {
|
pub fn flag(database: &mut PgConnection, match_id: DotaMatchId) -> AnyResult<Self> {
|
||||||
use crate::interfaces::database::query_prelude::*;
|
use crate::interfaces::database::query_prelude::*;
|
||||||
use schema::brooch_match;
|
|
||||||
|
|
||||||
log::debug!("Flagging {match_id:?} as parsed...");
|
log::debug!("Flagging {match_id:?} as parsed...");
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use anyhow::Context;
|
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::deserialize::FromSql;
|
||||||
use diesel::pg::{Pg, PgValue};
|
use diesel::pg::Pg;
|
||||||
use diesel::serialize::ToSql;
|
use diesel::serialize::ToSql;
|
||||||
|
|
||||||
use crate::newtype_sql;
|
use crate::newtype_sql;
|
||||||
|
@ -21,6 +21,8 @@ pub struct MatchmakingEvent {
|
||||||
impl MatchmakingEvent {
|
impl MatchmakingEvent {
|
||||||
/// Create a new [MatchmakingEvent].
|
/// Create a new [MatchmakingEvent].
|
||||||
pub fn create(database: &mut PgConnection, text: &str, starts_at: &chrono::DateTime<chrono::Local>) -> AnyResult<Self> {
|
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)
|
insert_into(matchmaking_events::table)
|
||||||
.values(&(
|
.values(&(
|
||||||
matchmaking_events::text.eq(text),
|
matchmaking_events::text.eq(text),
|
||||||
|
@ -32,6 +34,8 @@ impl MatchmakingEvent {
|
||||||
|
|
||||||
/// Retrieve a [MatchmakingEvent] from the database, given its [MatchmakingId].
|
/// Retrieve a [MatchmakingEvent] from the database, given its [MatchmakingId].
|
||||||
pub fn get(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Self> {
|
pub fn get(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Self> {
|
||||||
|
use crate::interfaces::database::query_prelude::*;
|
||||||
|
|
||||||
matchmaking_events::table
|
matchmaking_events::table
|
||||||
.filter(matchmaking_events::id.eq(matchmaking_id.0))
|
.filter(matchmaking_events::id.eq(matchmaking_id.0))
|
||||||
.get_result::<Self>(database)
|
.get_result::<Self>(database)
|
||||||
|
|
|
@ -20,11 +20,9 @@ pub struct MatchmakingMessageTelegram {
|
||||||
|
|
||||||
#[cfg(feature = "service_telegram")]
|
#[cfg(feature = "service_telegram")]
|
||||||
pub(crate) mod telegram_ext {
|
pub(crate) mod telegram_ext {
|
||||||
use std::cmp::Ordering;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use chrono::DateTime;
|
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use diesel::PgConnection;
|
use diesel::PgConnection;
|
||||||
use teloxide::payloads::EditMessageTextSetters;
|
use teloxide::payloads::EditMessageTextSetters;
|
||||||
|
@ -32,8 +30,6 @@ pub(crate) mod telegram_ext {
|
||||||
use teloxide::requests::Requester;
|
use teloxide::requests::Requester;
|
||||||
use teloxide::types::ParseMode;
|
use teloxide::types::ParseMode;
|
||||||
|
|
||||||
use matchmaking_messages_telegram::star;
|
|
||||||
|
|
||||||
use crate::interfaces::database::models::{MatchmakingChoice, MatchmakingId, MatchmakingReply, RoyalnetUser, TelegramUser};
|
use crate::interfaces::database::models::{MatchmakingChoice, MatchmakingId, MatchmakingReply, RoyalnetUser, TelegramUser};
|
||||||
use crate::utils::anyhow_result::AnyResult;
|
use crate::utils::anyhow_result::AnyResult;
|
||||||
use crate::utils::telegram_string::TelegramEscape;
|
use crate::utils::telegram_string::TelegramEscape;
|
||||||
|
@ -106,8 +102,7 @@ pub(crate) mod telegram_ext {
|
||||||
impl MatchmakingMessageTelegram {
|
impl MatchmakingMessageTelegram {
|
||||||
/// Get all the [MatchmakingMessageTelegram] for a specific [MatchmakingId].
|
/// Get all the [MatchmakingMessageTelegram] for a specific [MatchmakingId].
|
||||||
pub fn get_all(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Vec<Self>> {
|
pub fn get_all(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Vec<Self>> {
|
||||||
use diesel::prelude::*;
|
use crate::interfaces::database::query_prelude::*;
|
||||||
use crate::interfaces::database::schema::matchmaking_messages_telegram;
|
|
||||||
|
|
||||||
matchmaking_messages_telegram::table
|
matchmaking_messages_telegram::table
|
||||||
.filter(matchmaking_messages_telegram::matchmaking_id.eq(matchmaking_id.0))
|
.filter(matchmaking_messages_telegram::matchmaking_id.eq(matchmaking_id.0))
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub struct MatchmakingReply {
|
||||||
|
|
||||||
impl MatchmakingReply {
|
impl MatchmakingReply {
|
||||||
pub fn get_all_telegram(database: &mut PgConnection, matchmaking_id: MatchmakingId) -> AnyResult<Vec<(Self, RoyalnetUser, TelegramUser)>> {
|
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
|
matchmaking_replies::table
|
||||||
.filter(matchmaking_replies::matchmaking_id.eq(matchmaking_id))
|
.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> {
|
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)
|
insert_into(matchmaking_replies::table)
|
||||||
.values(&Self {
|
.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> {
|
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)
|
insert_into(matchmaking_replies::table)
|
||||||
.values(&Self {
|
.values(&Self {
|
||||||
|
|
|
@ -125,7 +125,7 @@ pub async fn handler(bot: &Bot, message: &Message, args: &DiarioArgs, database:
|
||||||
};
|
};
|
||||||
|
|
||||||
let entry = {
|
let entry = {
|
||||||
use schema::diario;
|
use crate::interfaces::database::query_prelude::*;
|
||||||
|
|
||||||
insert_into(diario::table)
|
insert_into(diario::table)
|
||||||
.values(&(
|
.values(&(
|
||||||
|
|
|
@ -8,7 +8,6 @@ use crate::utils::anyhow_result::AnyResult;
|
||||||
impl RoyalnetUser {
|
impl RoyalnetUser {
|
||||||
pub fn from_telegram_userid(database: &mut PgConnection, user_id: UserId) -> AnyResult<Self> {
|
pub fn from_telegram_userid(database: &mut PgConnection, user_id: UserId) -> AnyResult<Self> {
|
||||||
use crate::interfaces::database::query_prelude::*;
|
use crate::interfaces::database::query_prelude::*;
|
||||||
use schema::{telegram, users};
|
|
||||||
|
|
||||||
log::trace!("Retrieving RoyalnetUser with {user_id:?}");
|
log::trace!("Retrieving RoyalnetUser with {user_id:?}");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue