feat(types): add authentication type definitions
- Add Permission, Role, AdminUser interfaces - Add LoginRequest, LoginResponse, AuthState types - Update main types index with auth exports
This commit is contained in:
parent
b15c0ac5ab
commit
2ea8d19c87
|
|
@ -0,0 +1,53 @@
|
|||
export interface Permission {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
permissions: Permission[];
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface AdminUser {
|
||||
id: number;
|
||||
username: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
status: "active" | "inactive";
|
||||
permissions: Permission[];
|
||||
roles: Role[];
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface Tokens {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
admin_user: AdminUser;
|
||||
permissions: Permission[];
|
||||
tokens: Tokens;
|
||||
}
|
||||
|
||||
export interface LoginRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AuthState {
|
||||
isAuthenticated: boolean;
|
||||
user: AdminUser | null;
|
||||
permissions: Permission[];
|
||||
allPermissions: Permission[];
|
||||
token: string | null;
|
||||
refreshToken: string | null;
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
export * from "./auth";
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
name: string;
|
||||
|
|
|
|||
Loading…
Reference in New Issue