Skip to content

Commit

Permalink
fix: modify data type
Browse files Browse the repository at this point in the history
  • Loading branch information
K0nnyaku committed Nov 28, 2024
1 parent e293432 commit 8616a43
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/models/organization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Organization {
pub owner: Vec<Thing>,
pub member: Vec<Thing>,

pub creator: Thing,
pub creator: String,

pub created_at: chrono::NaiveDateTime,
pub updated_at: chrono::NaiveDateTime,
Expand Down
9 changes: 5 additions & 4 deletions src/utils/organization.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use serde::Deserialize;
use surrealdb::{engine::remote::ws::Client, sql::Thing, Surreal};
use surrealdb::{engine::remote::ws::Client,Surreal};

use crate::models::organization::{CreateOrganization, Organization};

Expand All @@ -9,17 +9,17 @@ pub async fn create(
id: &str,
org: CreateOrganization,
) -> Result<Option<Organization>> {
let creator = Thing::from(("account", id));

Ok(db
.create("organization")
.content(Organization {
id: None,
name: org.name,
display_name: org.display_name,
description: org.description,
owner: vec![creator.clone()],
owner: vec![("account", id).into()],
member: vec![],
creator,
creator: id.to_string(),
created_at: chrono::Local::now().naive_local(),
updated_at: chrono::Local::now().naive_local(),
})
Expand All @@ -32,3 +32,4 @@ where
{
Ok(db.select(("organization", id)).await?)
}

0 comments on commit 8616a43

Please sign in to comment.