Skip to content
Clone

refactor(issues): remove issue_stopwatch types (inlined)

zhenyi committed
parent bbb15f7 commit af1d988 Browse files

1 file changed

+0 −31

Deleted lib/issues/features/issue_stopwatch/types.rs
@@ -1,31 +0,0 @@
1use db::issue::stopwatch as sw_entity;
2use serde::{Deserialize, Serialize};
3use time::OffsetDateTime;
4use time::format_description::well_known::Rfc3339;
5use utoipa::ToSchema;
6use uuid::Uuid;
7
8fn fmt_ts(ts: OffsetDateTime) -> String {
9 ts.format(&Rfc3339).unwrap_or_default()
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
13pub struct StopwatchView {
14 pub id: Uuid,
15 pub issue_id: Uuid,
16 pub user_id: Uuid,
17 pub started_at: String,
18 pub created_at: String,
19}
20
21impl From<sw_entity::Model> for StopwatchView {
22 fn from(m: sw_entity::Model) -> Self {
23 Self {
24 id: m.id,
25 issue_id: m.issue_id,
26 user_id: m.user_id,
27 started_at: fmt_ts(m.started_at),
28 created_at: fmt_ts(m.created_at),
29 }
30 }
31}