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}
30
31#[derive(Clone, Debug, Serialize, Deserialize)]
32#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
33#[allow(clippy::struct_excessive_bools)]
34pub struct PublicContestConfig {
35 pub id: i64,
36 pub owner_id: Option<i64>,
37 pub owner_login: Option<String>,
38 pub name_ru: String,
39 pub name_en: String,
40 pub starts_at: DateTime<Utc>,
41 pub finishes_at: DateTime<Utc>,
42 pub statements_url_ru: String,
43 pub statements_url_en: String,
44 pub editorial_url_ru: String,
45 pub editorial_url_en: String,
46 pub hidden: bool,
47 pub upsolving_enabled: bool,
48 pub solutions_hidden: bool,
49 pub leaderboard_hidden: bool,
50 pub co_authors: Vec<i64>,
51 pub created_at: DateTime<Utc>,
52}
53
54#[derive(Clone, Debug, Serialize, Deserialize)]
55pub struct ContestPostRequest {
56 pub title_ru: String,
57 pub title_en: String,
58 pub text_ru: String,
59 pub text_en: String,
60}
61
62#[derive(Deserialize, Serialize, Clone, Debug)]
63#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
64pub struct ContestPost {
65 pub id: i64,
66 pub owner_id: i64,
67 pub owner_login: String,
68 pub contest_id: i64,
69 pub title_ru: String,
70 pub title_en: String,
71 pub text_ru: String,
72 pub text_en: String,
73 pub created_at: DateTime<Utc>,
74}