api/routes/modules/assignments/submissions/
common.rs1use serde::{Deserialize, Serialize};
18
19#[derive(Debug, Deserialize)]
21pub struct ListSubmissionsQuery {
22 pub page: Option<u32>,
23 pub per_page: Option<u32>,
24 pub sort: Option<String>,
25 pub query: Option<String>,
26 pub username: Option<String>,
27 pub late: Option<bool>,
28}
29
30#[derive(Debug, Serialize, Clone)]
32pub struct UserResponse {
33 pub id: i64,
34 pub username: String,
35 pub email: String,
36}
37
38#[derive(Debug, Serialize, Deserialize, Clone)]
40pub struct Mark {
41 pub earned: i64,
42 pub total: i64,
43}
44
45#[derive(Debug, Serialize)]
47pub struct SubmissionListItem {
48 pub id: i64,
49 pub user: UserResponse,
50 pub attempt: i64,
51 pub filename: String,
52 pub created_at: String,
53 pub updated_at: String,
54 pub is_practice: bool,
55 pub is_late: bool,
56 pub mark: Option<Mark>,
57}
58
59#[derive(Debug, Serialize)]
61pub struct SubmissionsListResponse {
62 pub submissions: Vec<SubmissionListItem>,
63 pub page: u32,
64 pub per_page: u32,
65 pub total: u64,
66}
67
68#[derive(Debug, Serialize)]
70pub struct SubmissionResponse {
71 pub id: i64,
72 pub attempt: i64,
73 pub filename: String,
74 pub created_at: String,
75 pub updated_at: String,
76 pub is_late: bool,
77 pub is_practice: bool,
78 pub mark: Option<Mark>,
79}
80
81#[derive(Debug, Serialize, Deserialize)]
83pub struct MarkSummary {
84 pub earned: i64,
85 pub total: i64,
86}
87
88#[derive(Debug, Serialize, Deserialize)]
90pub struct CodeComplexitySummary {
91 pub earned: i64,
92 pub total: i64,
93}
94
95#[derive(Debug, Serialize, Deserialize)]
97pub struct CodeComplexity {
98 pub summary: CodeComplexitySummary,
99 pub metrics: Vec<serde_json::Value>,
100}
101
102#[derive(Debug, Serialize, Deserialize)]
104pub struct SubmissionDetailResponse {
105 pub id: i64,
106 pub attempt: i64,
107 pub filename: String,
108 pub hash: String,
109 pub created_at: String,
110 pub updated_at: String,
111 pub mark: MarkSummary,
112 pub is_practice: bool,
113 pub is_late: bool,
114 pub tasks: Vec<serde_json::Value>,
115 #[serde(skip_serializing_if = "Option::is_none")]
116 pub code_coverage: Option<Vec<serde_json::Value>>,
117 #[serde(skip_serializing_if = "Option::is_none")]
118 pub code_complexity: Option<CodeComplexity>,
119}