Add Login and Dashboard

This commit is contained in:
Thanakarn Klangkasame
2025-10-05 19:17:42 +07:00
parent 594e0d42d1
commit 7fb60ba0f5
26 changed files with 1750 additions and 243 deletions

2
src/types/auth/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from "./user";
export * from "./upstream";

View File

@@ -0,0 +1,19 @@
export type UpstreamLoginUser = {
userId: string;
tenantId: string;
email?: string;
tenantKey?: string;
};
export type UpstreamLoginResponse = {
user: UpstreamLoginUser;
access_token?: string;
token_type?: string;
expires_at?: string;
};
export type UpstreamRefreshResponse = {
access_token?: string;
token_type?: string;
expires_at?: string;
};

18
src/types/auth/user.ts Normal file
View File

@@ -0,0 +1,18 @@
export type UserDebug = {
alg: string | undefined;
hasExp: boolean;
hasNbf: boolean;
iss: unknown;
aud: unknown;
sid: unknown;
jti: unknown;
};
export type UserSession = {
id: string;
email?: string;
tenantId?: string;
tenantKey?: string;
roles: string[];
_dbg?: UserDebug;
};

1
src/types/crm/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./loyalty";

13
src/types/crm/loyalty.ts Normal file
View File

@@ -0,0 +1,13 @@
export type RedeemRequest = {
transactionId: string;
contact: { phone: string };
metadata?: Record<string, unknown>;
};
export type RedeemResponse = {
balance?: number;
voucherCode?: string;
ledgerEntryId?: string;
redeemed?: boolean;
message?: string;
};