1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, Serialize, Deserialize)]
5#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
6pub struct LeaderboardRow {
7 pub user_id: i64,
8 pub user_login: String,
9 pub scores: Vec<f64>,
10 pub total_score: f64,
11}
12
13#[derive(Clone, Debug, Serialize, Deserialize)]
14#[allow(clippy::struct_excessive_bools)]
15pub struct ContestRequest {
16 pub name_ru: String,
17 pub name_en: String,
18 pub starts_at: DateTime<Utc>,
19 pub finishes_at: DateTime<Utc>,
20 pub statements_url_ru: String,
21 pub statements_url_en: String,
22 pub editorial_url_ru: String,
23 pub editorial_url_en: String,
24 pub hidden: bool,
25 pub upsolving_enabled: bool,
26 pub solutions_hidden: bool,
27 pub leaderboard_hidden: bool,
28 pub co_authors: Vec<i64>,
29 pub created_at: DateTime<Utc>,
30}
31
32#[derive(Clone, Debug, Serialize, Deserialize)]
33#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
34#[allow(clippy::struct_excessive_bools)]
35pub struct PublicContestConfig {
36 pub id: i64,
37 pub owner_id: Option<i64>,
38 pub owner_login: Option<String>,
39 pub name_ru: String,
40 pub name_en: String,
41 pub starts_at: DateTime<Utc>,
42 pub finishes_at: DateTime<Utc>,
43 pub statements_url_ru: String,
44 pub statements_url_en: String,
45 pub editorial_url_ru: String,
46 pub editorial_url_en: String,
47 pub hidden: bool,
48 pub upsolving_enabled: bool,
49 pub solutions_hidden: bool,
50 pub leaderboard_hidden: bool,
51 pub co_authors: Vec<i64>,
52 pub created_at: DateTime<Utc>,
53}
54
55#[derive(Clone, Debug, Serialize, Deserialize)]
56pub struct ContestPostRequest {
57 pub title_ru: String,
58 pub title_en: String,
59 pub text_ru: String,
60 pub text_en: String,
61}
62
63#[derive(Deserialize, Serialize, Clone, Debug)]
64#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
65pub struct ContestPost {
66 pub id: i64,
67 pub owner_id: i64,
68 pub owner_login: String,
69 pub contest_id: i64,
70 pub title_ru: String,
71 pub title_en: String,
72 pub text_ru: String,
73 pub text_en: String,
74 pub created_at: DateTime<Utc>,
75}