feature/wasm
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | use crate::{app_auth::AuthApp, ar_date_format}; |
| 2 | use chrono::{DateTime, Utc}; |
| 3 | use serde::{Deserialize, Serialize}; |
| 4 | |
| 5 | #[derive(Deserialize, Debug, Serialize)] |
| 6 | pub struct Config { |
| 7 | pub current_project: Option<Project>, |
| 8 | pub current_auth_app: Option<AuthApp>, |
| 9 | } |
| 10 | |
| 11 | #[derive(Deserialize, Debug, Serialize)] |
| 12 | pub struct Project { |
| 13 | pub id: i32, |
| 14 | pub name: String, |
| 15 | pub description: String, |
| 16 | #[serde(with = "ar_date_format")] |
| 17 | pub created_at: DateTime<Utc>, |
| 18 | #[serde(with = "ar_date_format")] |
| 19 | pub updated_at: DateTime<Utc>, |
| 20 | } |
| 21 | #[derive(Serialize, Debug)] |
| 22 | pub struct ProjectCreate { |
| 23 | pub name: String, |
| 24 | pub description: String, |
| 25 | } |
| 26 | |
| 27 | #[cfg(test)] |
| 28 | mod tests { |
| 29 | use super::*; |
| 30 | use serde_json::json; |
| 31 | #[test] |
| 32 | fn test_project_create() { |
| 33 | let project_create = ProjectCreate { |
| 34 | name: "test".to_owned(), |
| 35 | description: "test".to_owned(), |
| 36 | }; |
| 37 | let json = json!({ |
| 38 | "name": "test", |
| 39 | "description": "test", |
| 40 | }); |
| 41 | assert_eq!(serde_json::to_value(project_create).unwrap(), json); |
| 42 | } |
| 43 | } |