summaryrefslogtreecommitdiff
path: root/src/database/submission.rs
blob: 2ec1287c1c4cc7e9b27b495bf4a50b84aeafd44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use serde::Serialize;

#[derive(Serialize)]
pub struct Submission {
    id: i64,
    user_id: i64,
    problem_id: i64,
    code: String,
    language: String,
    validated: bool,
}

impl Submission {
    pub(super) fn new(
        id: i64,
        user_id: i64,
        problem_id: i64,
        code: String,
        language: String,
        validated: bool,
    ) -> Self {
        Self { id, user_id, problem_id, code, language, validated }
    }

    pub fn id(&self) -> i64 { self.id }
    pub fn user_id(&self) -> i64 { self.user_id }
    pub fn problem_id(&self) -> i64 { self.problem_id }
    pub fn code(&self) -> &str { &self.code }
    pub fn language(&self) -> &str { &self.language }
    pub fn validated(&self) -> bool { self.validated }
}