typespec-rust-emitter 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/QWEN.md +83 -29
- package/README.md +36 -24
- package/dist/src/emitter.js +102 -112
- package/dist/src/emitter.js.map +1 -1
- package/example/output-rust/src/generated/server.rs +58 -156
- package/example/output-rust/src/generated/types.rs +12 -12
- package/example/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/emitter.ts +117 -144
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
use super::types::*;
|
|
2
2
|
use async_trait::async_trait;
|
|
3
3
|
use axum::{http::StatusCode, Json};
|
|
4
|
+
use axum::extract::Path;
|
|
5
|
+
use axum::Extension;
|
|
4
6
|
use eyre::Result;
|
|
5
7
|
|
|
6
8
|
#[async_trait]
|
|
@@ -9,147 +11,42 @@ pub trait Server: Send + Sync {
|
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
/// Retrieve a list of all groups for the current account (from view_learning_group).
|
|
12
|
-
async fn groups_list(&self
|
|
14
|
+
async fn groups_list(&self) -> Result<GroupsListResponse>;
|
|
13
15
|
/// Create a new group.
|
|
14
|
-
async fn groups_create(&self, claims: Self::Claims,
|
|
16
|
+
async fn groups_create(&self, claims: Self::Claims, body: CreateGroupBody) -> Result<GroupsCreateResponse>;
|
|
15
17
|
/// Get the details of a group by its ID.
|
|
16
|
-
async fn groups_get_by_id(&self,
|
|
18
|
+
async fn groups_get_by_id(&self, id: i64) -> Result<GroupsGetByIdResponse>;
|
|
17
19
|
/// Update a group. Only provide the fields that need to be changed.
|
|
18
|
-
async fn groups_update(&self, claims: Self::Claims,
|
|
20
|
+
async fn groups_update(&self, claims: Self::Claims, id: i64, body: UpdateGroupBody) -> Result<GroupsUpdateResponse>;
|
|
19
21
|
/// Soft delete a group. All subjects within the group will also be soft deleted.
|
|
20
|
-
async fn groups_delete(&self, claims: Self::Claims,
|
|
22
|
+
async fn groups_delete(&self, claims: Self::Claims, id: i64) -> Result<GroupsDeleteResponse>;
|
|
21
23
|
/// Retrieve a list of subjects for a group (from view_subject_statistics).
|
|
22
|
-
async fn subjects_list(&self,
|
|
24
|
+
async fn subjects_list(&self, group_id: i64) -> Result<SubjectsListResponse>;
|
|
23
25
|
/// Create a new subject within the specified group.
|
|
24
|
-
async fn subjects_create(&self, claims: Self::Claims,
|
|
26
|
+
async fn subjects_create(&self, claims: Self::Claims, group_id: i64, body: CreateSubjectBody) -> Result<SubjectsCreateResponse>;
|
|
25
27
|
/// Get the details of a subject by its ID.
|
|
26
|
-
async fn subjects_get_by_id(&self,
|
|
28
|
+
async fn subjects_get_by_id(&self, group_id: i64, id: i64) -> Result<SubjectsGetByIdResponse>;
|
|
27
29
|
/// Update a subject. Only provide the fields that need to be changed.
|
|
28
|
-
async fn subjects_update(&self, claims: Self::Claims,
|
|
30
|
+
async fn subjects_update(&self, claims: Self::Claims, group_id: i64, id: i64, body: UpdateSubjectBody) -> Result<SubjectsUpdateResponse>;
|
|
29
31
|
/// Soft delete a subject.
|
|
30
|
-
async fn subjects_delete(&self, claims: Self::Claims,
|
|
32
|
+
async fn subjects_delete(&self, claims: Self::Claims, group_id: i64, id: i64) -> Result<SubjectsDeleteResponse>;
|
|
31
33
|
/// Start a new study session for the subject.
|
|
32
34
|
/// The server creates a Log (status=Starting) and the first Timelog.
|
|
33
35
|
/// Returns 409 if the subject already has a session in Starting or Paused status.
|
|
34
|
-
async fn sessions_start(&self, claims: Self::Claims,
|
|
36
|
+
async fn sessions_start(&self, claims: Self::Claims, subject_id: i64, body: SessionNoteBody) -> Result<SessionsStartResponse>;
|
|
35
37
|
/// Pause the currently running session (transition from Starting to Paused).
|
|
36
38
|
/// The server closes the current Timelog (sets stoppedAt and calculates durationInSeconds).
|
|
37
39
|
/// Returns 409 if the session is not in the Starting state.
|
|
38
|
-
async fn sessions_pause(&self, claims: Self::Claims,
|
|
40
|
+
async fn sessions_pause(&self, claims: Self::Claims, subject_id: i64, log_id: i64) -> Result<SessionsPauseResponse>;
|
|
39
41
|
/// Resume a paused session (transition from Paused to Starting).
|
|
40
42
|
/// The server creates a new Timelog.
|
|
41
43
|
/// Returns 409 if the session is not in the Paused state.
|
|
42
|
-
async fn sessions_resume(&self, claims: Self::Claims,
|
|
44
|
+
async fn sessions_resume(&self, claims: Self::Claims, subject_id: i64, log_id: i64) -> Result<SessionsResumeResponse>;
|
|
43
45
|
/// End the session (transition from Starting or Paused to Stopped).
|
|
44
46
|
/// The server closes the current Timelog if it is running, and updates Log.stoppedAt.
|
|
45
47
|
/// Returns 409 if the session is already Stopped.
|
|
46
|
-
async fn sessions_stop(&self, claims: Self::Claims,
|
|
48
|
+
async fn sessions_stop(&self, claims: Self::Claims, subject_id: i64, log_id: i64, body: SessionNoteBody) -> Result<SessionsStopResponse>;
|
|
47
49
|
}
|
|
48
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
49
|
-
pub struct GroupsListRequest {
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
54
|
-
pub struct GroupsCreateRequest {
|
|
55
|
-
#[serde(rename = "body", flatten)]
|
|
56
|
-
pub body: CreateGroupBody,
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
60
|
-
pub struct GroupsGetByIdRequest {
|
|
61
|
-
#[serde(rename = "id", flatten)]
|
|
62
|
-
pub id: i64,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
66
|
-
pub struct GroupsUpdateRequest {
|
|
67
|
-
#[serde(rename = "id", flatten)]
|
|
68
|
-
pub id: i64,
|
|
69
|
-
#[serde(rename = "body", flatten)]
|
|
70
|
-
pub body: UpdateGroupBody,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
74
|
-
pub struct GroupsDeleteRequest {
|
|
75
|
-
#[serde(rename = "id", flatten)]
|
|
76
|
-
pub id: i64,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
80
|
-
pub struct SubjectsListRequest {
|
|
81
|
-
#[serde(rename = "groupId", flatten)]
|
|
82
|
-
pub group_id: i64,
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
86
|
-
pub struct SubjectsCreateRequest {
|
|
87
|
-
#[serde(rename = "groupId", flatten)]
|
|
88
|
-
pub group_id: i64,
|
|
89
|
-
#[serde(rename = "body", flatten)]
|
|
90
|
-
pub body: CreateSubjectBody,
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
94
|
-
pub struct SubjectsGetByIdRequest {
|
|
95
|
-
#[serde(rename = "groupId", flatten)]
|
|
96
|
-
pub group_id: i64,
|
|
97
|
-
#[serde(rename = "id", flatten)]
|
|
98
|
-
pub id: i64,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
102
|
-
pub struct SubjectsUpdateRequest {
|
|
103
|
-
#[serde(rename = "groupId", flatten)]
|
|
104
|
-
pub group_id: i64,
|
|
105
|
-
#[serde(rename = "id", flatten)]
|
|
106
|
-
pub id: i64,
|
|
107
|
-
#[serde(rename = "body", flatten)]
|
|
108
|
-
pub body: UpdateSubjectBody,
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
112
|
-
pub struct SubjectsDeleteRequest {
|
|
113
|
-
#[serde(rename = "groupId", flatten)]
|
|
114
|
-
pub group_id: i64,
|
|
115
|
-
#[serde(rename = "id", flatten)]
|
|
116
|
-
pub id: i64,
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
120
|
-
pub struct SessionsStartRequest {
|
|
121
|
-
#[serde(rename = "subjectId", flatten)]
|
|
122
|
-
pub subject_id: i64,
|
|
123
|
-
#[serde(rename = "body", flatten)]
|
|
124
|
-
pub body: SessionNoteBody,
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
128
|
-
pub struct SessionsPauseRequest {
|
|
129
|
-
#[serde(rename = "subjectId", flatten)]
|
|
130
|
-
pub subject_id: i64,
|
|
131
|
-
#[serde(rename = "logId", flatten)]
|
|
132
|
-
pub log_id: i64,
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
136
|
-
pub struct SessionsResumeRequest {
|
|
137
|
-
#[serde(rename = "subjectId", flatten)]
|
|
138
|
-
pub subject_id: i64,
|
|
139
|
-
#[serde(rename = "logId", flatten)]
|
|
140
|
-
pub log_id: i64,
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
#[derive(Debug, Clone, serde::Deserialize)]
|
|
144
|
-
pub struct SessionsStopRequest {
|
|
145
|
-
#[serde(rename = "subjectId", flatten)]
|
|
146
|
-
pub subject_id: i64,
|
|
147
|
-
#[serde(rename = "logId", flatten)]
|
|
148
|
-
pub log_id: i64,
|
|
149
|
-
#[serde(rename = "body", flatten)]
|
|
150
|
-
pub body: SessionNoteBody,
|
|
151
|
-
}
|
|
152
|
-
|
|
153
50
|
pub enum GroupsListResponse {
|
|
154
51
|
Ok(Json<Vec<GroupStatistics>>),
|
|
155
52
|
Unauthorized,
|
|
@@ -413,7 +310,7 @@ where
|
|
|
413
310
|
S: Server + Clone + Send + Sync + 'static,
|
|
414
311
|
S::Claims: Send + Sync + Clone + 'static,
|
|
415
312
|
{
|
|
416
|
-
let result = service.groups_list(
|
|
313
|
+
let result = service.groups_list().await;
|
|
417
314
|
match result {
|
|
418
315
|
Ok(response) => response.into_response(),
|
|
419
316
|
Err(e) => (
|
|
@@ -426,14 +323,14 @@ where
|
|
|
426
323
|
|
|
427
324
|
pub async fn groups_create_handler<S>(
|
|
428
325
|
axum::extract::State(service): axum::extract::State<S>,
|
|
429
|
-
|
|
430
|
-
|
|
326
|
+
Extension(claims): Extension<S::Claims>,
|
|
327
|
+
Json(payload): Json<CreateGroupBody>,
|
|
431
328
|
) -> impl axum::response::IntoResponse
|
|
432
329
|
where
|
|
433
330
|
S: Server + Clone + Send + Sync + 'static,
|
|
434
331
|
S::Claims: Send + Sync + Clone + 'static,
|
|
435
332
|
{
|
|
436
|
-
let result = service.groups_create(claims,
|
|
333
|
+
let result = service.groups_create(claims, payload).await;
|
|
437
334
|
match result {
|
|
438
335
|
Ok(response) => response.into_response(),
|
|
439
336
|
Err(e) => (
|
|
@@ -446,13 +343,13 @@ where
|
|
|
446
343
|
|
|
447
344
|
pub async fn groups_get_by_id_handler<S>(
|
|
448
345
|
axum::extract::State(service): axum::extract::State<S>,
|
|
449
|
-
|
|
346
|
+
Path(id): Path<i64>,
|
|
450
347
|
) -> impl axum::response::IntoResponse
|
|
451
348
|
where
|
|
452
349
|
S: Server + Clone + Send + Sync + 'static,
|
|
453
350
|
S::Claims: Send + Sync + Clone + 'static,
|
|
454
351
|
{
|
|
455
|
-
let result = service.groups_get_by_id(
|
|
352
|
+
let result = service.groups_get_by_id(id).await;
|
|
456
353
|
match result {
|
|
457
354
|
Ok(response) => response.into_response(),
|
|
458
355
|
Err(e) => (
|
|
@@ -465,14 +362,15 @@ where
|
|
|
465
362
|
|
|
466
363
|
pub async fn groups_update_handler<S>(
|
|
467
364
|
axum::extract::State(service): axum::extract::State<S>,
|
|
468
|
-
|
|
469
|
-
|
|
365
|
+
Extension(claims): Extension<S::Claims>,
|
|
366
|
+
Path(id): Path<i64>,
|
|
367
|
+
Json(payload): Json<UpdateGroupBody>,
|
|
470
368
|
) -> impl axum::response::IntoResponse
|
|
471
369
|
where
|
|
472
370
|
S: Server + Clone + Send + Sync + 'static,
|
|
473
371
|
S::Claims: Send + Sync + Clone + 'static,
|
|
474
372
|
{
|
|
475
|
-
let result = service.groups_update(claims,
|
|
373
|
+
let result = service.groups_update(claims, id, payload).await;
|
|
476
374
|
match result {
|
|
477
375
|
Ok(response) => response.into_response(),
|
|
478
376
|
Err(e) => (
|
|
@@ -485,14 +383,14 @@ where
|
|
|
485
383
|
|
|
486
384
|
pub async fn groups_delete_handler<S>(
|
|
487
385
|
axum::extract::State(service): axum::extract::State<S>,
|
|
488
|
-
|
|
489
|
-
|
|
386
|
+
Extension(claims): Extension<S::Claims>,
|
|
387
|
+
Path(id): Path<i64>,
|
|
490
388
|
) -> impl axum::response::IntoResponse
|
|
491
389
|
where
|
|
492
390
|
S: Server + Clone + Send + Sync + 'static,
|
|
493
391
|
S::Claims: Send + Sync + Clone + 'static,
|
|
494
392
|
{
|
|
495
|
-
let result = service.groups_delete(claims,
|
|
393
|
+
let result = service.groups_delete(claims, id).await;
|
|
496
394
|
match result {
|
|
497
395
|
Ok(response) => response.into_response(),
|
|
498
396
|
Err(e) => (
|
|
@@ -505,13 +403,13 @@ where
|
|
|
505
403
|
|
|
506
404
|
pub async fn subjects_list_handler<S>(
|
|
507
405
|
axum::extract::State(service): axum::extract::State<S>,
|
|
508
|
-
|
|
406
|
+
Path(group_id): Path<i64>,
|
|
509
407
|
) -> impl axum::response::IntoResponse
|
|
510
408
|
where
|
|
511
409
|
S: Server + Clone + Send + Sync + 'static,
|
|
512
410
|
S::Claims: Send + Sync + Clone + 'static,
|
|
513
411
|
{
|
|
514
|
-
let result = service.subjects_list(
|
|
412
|
+
let result = service.subjects_list(group_id).await;
|
|
515
413
|
match result {
|
|
516
414
|
Ok(response) => response.into_response(),
|
|
517
415
|
Err(e) => (
|
|
@@ -524,14 +422,15 @@ where
|
|
|
524
422
|
|
|
525
423
|
pub async fn subjects_create_handler<S>(
|
|
526
424
|
axum::extract::State(service): axum::extract::State<S>,
|
|
527
|
-
|
|
528
|
-
|
|
425
|
+
Extension(claims): Extension<S::Claims>,
|
|
426
|
+
Path(group_id): Path<i64>,
|
|
427
|
+
Json(payload): Json<CreateSubjectBody>,
|
|
529
428
|
) -> impl axum::response::IntoResponse
|
|
530
429
|
where
|
|
531
430
|
S: Server + Clone + Send + Sync + 'static,
|
|
532
431
|
S::Claims: Send + Sync + Clone + 'static,
|
|
533
432
|
{
|
|
534
|
-
let result = service.subjects_create(claims,
|
|
433
|
+
let result = service.subjects_create(claims, group_id, payload).await;
|
|
535
434
|
match result {
|
|
536
435
|
Ok(response) => response.into_response(),
|
|
537
436
|
Err(e) => (
|
|
@@ -544,13 +443,13 @@ where
|
|
|
544
443
|
|
|
545
444
|
pub async fn subjects_get_by_id_handler<S>(
|
|
546
445
|
axum::extract::State(service): axum::extract::State<S>,
|
|
547
|
-
|
|
446
|
+
Path((group_id, id)): Path<(i64, i64)>,
|
|
548
447
|
) -> impl axum::response::IntoResponse
|
|
549
448
|
where
|
|
550
449
|
S: Server + Clone + Send + Sync + 'static,
|
|
551
450
|
S::Claims: Send + Sync + Clone + 'static,
|
|
552
451
|
{
|
|
553
|
-
let result = service.subjects_get_by_id(
|
|
452
|
+
let result = service.subjects_get_by_id(group_id, id).await;
|
|
554
453
|
match result {
|
|
555
454
|
Ok(response) => response.into_response(),
|
|
556
455
|
Err(e) => (
|
|
@@ -563,14 +462,15 @@ where
|
|
|
563
462
|
|
|
564
463
|
pub async fn subjects_update_handler<S>(
|
|
565
464
|
axum::extract::State(service): axum::extract::State<S>,
|
|
566
|
-
|
|
567
|
-
|
|
465
|
+
Extension(claims): Extension<S::Claims>,
|
|
466
|
+
Path((group_id, id)): Path<(i64, i64)>,
|
|
467
|
+
Json(payload): Json<UpdateSubjectBody>,
|
|
568
468
|
) -> impl axum::response::IntoResponse
|
|
569
469
|
where
|
|
570
470
|
S: Server + Clone + Send + Sync + 'static,
|
|
571
471
|
S::Claims: Send + Sync + Clone + 'static,
|
|
572
472
|
{
|
|
573
|
-
let result = service.subjects_update(claims,
|
|
473
|
+
let result = service.subjects_update(claims, group_id, id, payload).await;
|
|
574
474
|
match result {
|
|
575
475
|
Ok(response) => response.into_response(),
|
|
576
476
|
Err(e) => (
|
|
@@ -583,14 +483,14 @@ where
|
|
|
583
483
|
|
|
584
484
|
pub async fn subjects_delete_handler<S>(
|
|
585
485
|
axum::extract::State(service): axum::extract::State<S>,
|
|
586
|
-
|
|
587
|
-
|
|
486
|
+
Extension(claims): Extension<S::Claims>,
|
|
487
|
+
Path((group_id, id)): Path<(i64, i64)>,
|
|
588
488
|
) -> impl axum::response::IntoResponse
|
|
589
489
|
where
|
|
590
490
|
S: Server + Clone + Send + Sync + 'static,
|
|
591
491
|
S::Claims: Send + Sync + Clone + 'static,
|
|
592
492
|
{
|
|
593
|
-
let result = service.subjects_delete(claims,
|
|
493
|
+
let result = service.subjects_delete(claims, group_id, id).await;
|
|
594
494
|
match result {
|
|
595
495
|
Ok(response) => response.into_response(),
|
|
596
496
|
Err(e) => (
|
|
@@ -603,14 +503,15 @@ where
|
|
|
603
503
|
|
|
604
504
|
pub async fn sessions_start_handler<S>(
|
|
605
505
|
axum::extract::State(service): axum::extract::State<S>,
|
|
606
|
-
|
|
607
|
-
|
|
506
|
+
Extension(claims): Extension<S::Claims>,
|
|
507
|
+
Path(subject_id): Path<i64>,
|
|
508
|
+
Json(payload): Json<SessionNoteBody>,
|
|
608
509
|
) -> impl axum::response::IntoResponse
|
|
609
510
|
where
|
|
610
511
|
S: Server + Clone + Send + Sync + 'static,
|
|
611
512
|
S::Claims: Send + Sync + Clone + 'static,
|
|
612
513
|
{
|
|
613
|
-
let result = service.sessions_start(claims,
|
|
514
|
+
let result = service.sessions_start(claims, subject_id, payload).await;
|
|
614
515
|
match result {
|
|
615
516
|
Ok(response) => response.into_response(),
|
|
616
517
|
Err(e) => (
|
|
@@ -623,14 +524,14 @@ where
|
|
|
623
524
|
|
|
624
525
|
pub async fn sessions_pause_handler<S>(
|
|
625
526
|
axum::extract::State(service): axum::extract::State<S>,
|
|
626
|
-
|
|
627
|
-
|
|
527
|
+
Extension(claims): Extension<S::Claims>,
|
|
528
|
+
Path((subject_id, log_id)): Path<(i64, i64)>,
|
|
628
529
|
) -> impl axum::response::IntoResponse
|
|
629
530
|
where
|
|
630
531
|
S: Server + Clone + Send + Sync + 'static,
|
|
631
532
|
S::Claims: Send + Sync + Clone + 'static,
|
|
632
533
|
{
|
|
633
|
-
let result = service.sessions_pause(claims,
|
|
534
|
+
let result = service.sessions_pause(claims, subject_id, log_id).await;
|
|
634
535
|
match result {
|
|
635
536
|
Ok(response) => response.into_response(),
|
|
636
537
|
Err(e) => (
|
|
@@ -643,14 +544,14 @@ where
|
|
|
643
544
|
|
|
644
545
|
pub async fn sessions_resume_handler<S>(
|
|
645
546
|
axum::extract::State(service): axum::extract::State<S>,
|
|
646
|
-
|
|
647
|
-
|
|
547
|
+
Extension(claims): Extension<S::Claims>,
|
|
548
|
+
Path((subject_id, log_id)): Path<(i64, i64)>,
|
|
648
549
|
) -> impl axum::response::IntoResponse
|
|
649
550
|
where
|
|
650
551
|
S: Server + Clone + Send + Sync + 'static,
|
|
651
552
|
S::Claims: Send + Sync + Clone + 'static,
|
|
652
553
|
{
|
|
653
|
-
let result = service.sessions_resume(claims,
|
|
554
|
+
let result = service.sessions_resume(claims, subject_id, log_id).await;
|
|
654
555
|
match result {
|
|
655
556
|
Ok(response) => response.into_response(),
|
|
656
557
|
Err(e) => (
|
|
@@ -663,14 +564,15 @@ where
|
|
|
663
564
|
|
|
664
565
|
pub async fn sessions_stop_handler<S>(
|
|
665
566
|
axum::extract::State(service): axum::extract::State<S>,
|
|
666
|
-
|
|
667
|
-
|
|
567
|
+
Extension(claims): Extension<S::Claims>,
|
|
568
|
+
Path((subject_id, log_id)): Path<(i64, i64)>,
|
|
569
|
+
Json(payload): Json<SessionNoteBody>,
|
|
668
570
|
) -> impl axum::response::IntoResponse
|
|
669
571
|
where
|
|
670
572
|
S: Server + Clone + Send + Sync + 'static,
|
|
671
573
|
S::Claims: Send + Sync + Clone + 'static,
|
|
672
574
|
{
|
|
673
|
-
let result = service.sessions_stop(claims,
|
|
575
|
+
let result = service.sessions_stop(claims, subject_id, log_id, payload).await;
|
|
674
576
|
match result {
|
|
675
577
|
Ok(response) => response.into_response(),
|
|
676
578
|
Err(e) => (
|
|
@@ -49,9 +49,9 @@ pub struct Group {
|
|
|
49
49
|
#[serde(rename = "accountId")]
|
|
50
50
|
pub account_id: uuid::Uuid,
|
|
51
51
|
#[serde(rename = "createdAt")]
|
|
52
|
-
pub created_at:
|
|
52
|
+
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
53
53
|
#[serde(rename = "deletedAt")]
|
|
54
|
-
pub deleted_at: Option<
|
|
54
|
+
pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
55
55
|
pub name: String,
|
|
56
56
|
pub icon: String,
|
|
57
57
|
#[serde(rename = "colorText")]
|
|
@@ -66,9 +66,9 @@ pub struct GroupStatistics {
|
|
|
66
66
|
#[serde(rename = "accountId")]
|
|
67
67
|
pub account_id: uuid::Uuid,
|
|
68
68
|
#[serde(rename = "createdAt")]
|
|
69
|
-
pub created_at:
|
|
69
|
+
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
70
70
|
#[serde(rename = "deletedAt")]
|
|
71
|
-
pub deleted_at: Option<
|
|
71
|
+
pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
72
72
|
pub name: String,
|
|
73
73
|
pub icon: String,
|
|
74
74
|
#[serde(rename = "colorText")]
|
|
@@ -120,9 +120,9 @@ pub struct Subject {
|
|
|
120
120
|
#[serde(rename = "groupId")]
|
|
121
121
|
pub group_id: i64,
|
|
122
122
|
#[serde(rename = "createdAt")]
|
|
123
|
-
pub created_at:
|
|
123
|
+
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
124
124
|
#[serde(rename = "deletedAt")]
|
|
125
|
-
pub deleted_at: Option<
|
|
125
|
+
pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
126
126
|
pub name: String,
|
|
127
127
|
pub icon: String,
|
|
128
128
|
#[serde(rename = "colorText")]
|
|
@@ -139,9 +139,9 @@ pub struct SubjectStatistics {
|
|
|
139
139
|
#[serde(rename = "groupId")]
|
|
140
140
|
pub group_id: i64,
|
|
141
141
|
#[serde(rename = "createdAt")]
|
|
142
|
-
pub created_at:
|
|
142
|
+
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
143
143
|
#[serde(rename = "deletedAt")]
|
|
144
|
-
pub deleted_at: Option<
|
|
144
|
+
pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
145
145
|
pub name: String,
|
|
146
146
|
pub icon: String,
|
|
147
147
|
#[serde(rename = "colorText")]
|
|
@@ -191,9 +191,9 @@ pub struct Log {
|
|
|
191
191
|
#[serde(rename = "subjectId")]
|
|
192
192
|
pub subject_id: i64,
|
|
193
193
|
#[serde(rename = "startedAt")]
|
|
194
|
-
pub started_at:
|
|
194
|
+
pub started_at: chrono::DateTime<chrono::Utc>,
|
|
195
195
|
#[serde(rename = "stoppedAt")]
|
|
196
|
-
pub stopped_at: Option<
|
|
196
|
+
pub stopped_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
197
197
|
#[serde(rename = "logContent")]
|
|
198
198
|
pub log_content: Option<String>,
|
|
199
199
|
pub status: StudyStatus,
|
|
@@ -209,9 +209,9 @@ pub struct Timelog {
|
|
|
209
209
|
#[serde(rename = "subjectId")]
|
|
210
210
|
pub subject_id: i64,
|
|
211
211
|
#[serde(rename = "startedAt")]
|
|
212
|
-
pub started_at:
|
|
212
|
+
pub started_at: chrono::DateTime<chrono::Utc>,
|
|
213
213
|
#[serde(rename = "stoppedAt")]
|
|
214
|
-
pub stopped_at: Option<
|
|
214
|
+
pub stopped_at: Option<chrono::DateTime<chrono::Utc>>,
|
|
215
215
|
#[serde(rename = "durationInSeconds")]
|
|
216
216
|
pub duration_in_seconds: i64,
|
|
217
217
|
}
|