| 1 | export interface RouteMetaAuth { |
| 2 | checkAuth?: boolean |
| 3 | authRedirect?: string |
| 4 | auth?: boolean |
| 5 | roles?: RouteMetaAuthRole | RouteMetaAuthRole[] |
| 6 | } |
| 7 | |
| 8 | export enum RouteRole { |
| 9 | All = "all" |
| 10 | } |
| 11 | |
| 12 | export enum AuthUserRole { |
| 13 | Unknown = 0, |
| 14 | Admin = 1, |
| 15 | Analyst = 2, |
| 16 | Scheduler = 3, |
| 17 | CustomerUser = 4 |
| 18 | } |
| 19 | |
| 20 | export type RouteMetaAuthRole = AuthUserRole | RouteRole |
| 21 | |
| 22 | export interface JWTPayload extends jose.JWTPayload { |
| 23 | scopes: JWTRole[] |
| 24 | } |
| 25 | |
| 26 | export type JWTRole = "admin" | "analyst" |
| 27 | |
| 28 | export interface AuthUser { |
| 29 | access_token: string |
| 30 | role: AuthUserRole |
| 31 | username: string |
| 32 | email: string |
| 33 | } |
| 34 | |
| 35 | export interface LoginPayload { |
| 36 | username: string |
| 37 | password: string |
| 38 | } |
| 39 | |
| 40 | export interface RegisterPayload { |
| 41 | username: string |
| 42 | password: string |
| 43 | email: string |
| 44 | role_id: number |
| 45 | /* |
| 46 | customerCode: string |
| 47 | usersFirstName: string |
| 48 | usersLastName: string |
| 49 | usersRole: "admin" |
| 50 | imageFile: string |
| 51 | notifications: number |
| 52 | */ |
| 53 | } |