feat: Implement multi-tenancy with new database migrations, API updates across services, and refactor frontend API calls.
This commit is contained in:
@@ -6,11 +6,12 @@ use chrono::{Utc, Duration};
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Claims {
|
||||
pub sub: Uuid,
|
||||
pub org: Uuid,
|
||||
pub exp: i64,
|
||||
pub role: String,
|
||||
}
|
||||
|
||||
pub fn create_jwt(user_id: Uuid, role: &str) -> Result<String, jsonwebtoken::errors::Error> {
|
||||
pub fn create_jwt(user_id: Uuid, organization_id: Uuid, role: &str) -> Result<String, jsonwebtoken::errors::Error> {
|
||||
let expiration = Utc::now()
|
||||
.checked_add_signed(Duration::hours(24))
|
||||
.expect("valid timestamp")
|
||||
@@ -18,6 +19,7 @@ pub fn create_jwt(user_id: Uuid, role: &str) -> Result<String, jsonwebtoken::err
|
||||
|
||||
let claims = Claims {
|
||||
sub: user_id,
|
||||
org: organization_id,
|
||||
exp: expiration,
|
||||
role: role.to_string(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user