Skip to content
Clone

feat(export): add project activities export

zhenyi committed
parent 4b42813 commit a7bf59f Browse files

1 file changed

+40 −0

Added lib/export/project/activities.rs View lib/export/project/activities.rs
@@ -0,0 +1,40 @@
1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3use time::OffsetDateTime;
4use utoipa::{IntoParams, ToSchema};
5use uuid::Uuid;
6
7#[derive(Debug, Clone, Serialize, ToSchema)]
8pub struct ActivityView {
9 pub id: Uuid,
10 pub project_id: Uuid,
11 pub actor_id: Uuid,
12 pub verb: String,
13 pub target_kind: String,
14 pub target_id: Option<Uuid>,
15 pub payload: Option<Value>,
16 pub created_at: OffsetDateTime,
17}
18
19#[derive(Debug, Clone, Deserialize, ToSchema, IntoParams)]
20pub struct ListActivityQuery {
21 pub verb: Option<String>,
22 #[serde(default = "default_page")]
23 pub page: u64,
24 #[serde(default = "default_per_page")]
25 pub per_page: u64,
26}
27
28fn default_page() -> u64 {
29 1
30}
31
32fn default_per_page() -> u64 {
33 20
34}
35
36#[derive(Debug, Clone, Serialize, ToSchema)]
37pub struct ActivityPage {
38 pub total: u64,
39 pub items: Vec<ActivityView>,
40}
No newline at end of file