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 pub hide_leaderboard: bool,
45 pub co_authors: Vec<i64>,
47}
48
49#[derive(Clone, Debug, Serialize, Deserialize)]
51pub struct PublicContestConfig {
52 pub id: i64,
54 pub owner_id: Option<i64>,
56 pub name_ru: String,
58 pub name_en: String,
60 pub statements_url_ru: String,
62 pub editorial_url_ru: String,
64 pub statements_url_en: String,
66 pub editorial_url_en: String,
68 pub starts_at: DateTime<Utc>,
70 pub ends_at: DateTime<Utc>,
72 pub hidden: bool,
74 pub upsolving_opened: bool,
76 pub hide_solutions: bool,
78 pub hide_leaderboard: bool,
80 pub co_authors: Vec<i64>,
82}
83
84#[derive(Clone, Debug, Serialize, Deserialize)]
86pub struct ContestPostRequest {
87 pub title_ru: String,
89 pub text_ru: String,
91 pub title_en: String,
93 pub text_en: String,
95}
96
97#[derive(Deserialize, Serialize, Clone, Debug)]
99#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
100pub struct ContestPost {
101 pub id: i64,
103 pub owner_id: i64,
105 pub contest_id: i64,
107 pub title_ru: String,
109 pub text_ru: String,
111 pub title_en: String,
113 pub text_en: String,
115 pub created_at: DateTime<Utc>,
117}