1use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[derive(Clone, Debug, Serialize, Deserialize)]
8#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
9pub struct LeaderboardRow {
10 pub user_id: i64,
12 pub scores: Vec<i32>,
14 pub total_score: i64,
16}
17
18#[derive(Clone, Debug, Serialize, Deserialize)]
20pub struct ContestRequest {
21 pub name_ru: String,
23 pub name_en: String,
25 pub starts_at: DateTime<Utc>,
27 pub ends_at: DateTime<Utc>,
29 pub statements_url_ru: String,
31 pub editorial_url_ru: String,
33 pub statements_url_en: String,
35 pub editorial_url_en: String,
37 pub hidden: bool,
39 pub upsolving_opened: bool,
41 pub hide_solutions: bool,
43}
44
45#[derive(Clone, Debug, Serialize, Deserialize)]
47pub struct PublicContestConfig {
48 pub id: i64,
50 pub owner_id: Option<i64>,
52 pub name_ru: String,
54 pub name_en: String,
56 pub statements_url_ru: String,
58 pub editorial_url_ru: String,
60 pub statements_url_en: String,
62 pub editorial_url_en: String,
64 pub starts_at: DateTime<Utc>,
66 pub ends_at: DateTime<Utc>,
68 pub hidden: bool,
70 pub upsolving_opened: bool,
72 pub hide_solutions: bool,
74}
75
76#[derive(Clone, Debug, Serialize, Deserialize)]
78pub struct ContestPostRequest {
79 pub title_ru: String,
81 pub text_ru: String,
83 pub title_en: String,
85 pub text_en: String,
87 pub created_at: DateTime<Utc>,
89}
90
91#[derive(Deserialize, Serialize, Clone, Debug)]
93#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
94pub struct ContestPost {
95 pub id: i64,
97 pub owner_id: i64,
99 pub contest_id: i64,
101 pub title_ru: String,
103 pub text_ru: String,
105 pub title_en: String,
107 pub text_en: String,
109 pub created_at: DateTime<Utc>,
111}