forked from Txio-labs/txio-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkspace.rs
More file actions
38 lines (35 loc) · 990 Bytes
/
Copy pathworkspace.rs
File metadata and controls
38 lines (35 loc) · 990 Bytes
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
32
33
34
35
36
37
38
use chrono::{DateTime, Utc};
use mongodb::bson::oid::ObjectId;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub enum WorkspaceType {
#[default]
Personal,
Team,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Workspace {
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub id: Option<ObjectId>,
pub user_id: ObjectId,
pub name: String,
#[serde(rename = "type", default)]
pub workspace_type: WorkspaceType,
#[serde(default)]
pub active_env_id: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
impl Workspace {
pub fn new(user_id: ObjectId, name: String, workspace_type: WorkspaceType) -> Self {
Self {
id: None,
user_id,
name,
workspace_type,
active_env_id: None,
created_at: Utc::now(),
updated_at: Utc::now(),
}
}
}