good forst commit

This commit is contained in:
2026-06-09 02:02:40 +05:30
parent 801c1d7121
commit 249d759e6a
215 changed files with 15425 additions and 1240 deletions
+61
View File
@@ -0,0 +1,61 @@
export type AdminRole = 'OWNER' | 'ADMIN' | 'VIEWER';
export type JwtKind = 'admin' | 'member' | 'superadmin';
export interface AdminJwtPayload {
kind: 'admin';
sub: string;
tenantId: string;
role: AdminRole;
email: string;
}
export interface MemberJwtPayload {
kind: 'member';
sub: string;
tenantId: string;
jid: string;
phoneHash: string;
}
export interface SuperAdminJwtPayload {
kind: 'superadmin';
sub: string;
email: string;
}
export type JwtPayload = AdminJwtPayload | MemberJwtPayload | SuperAdminJwtPayload;
export interface LoginRequest {
tenantSlug?: string;
email: string;
password: string;
}
export interface LoginResponse {
token: string;
admin: {
id: string;
email: string;
role: AdminRole;
tenantId: string;
tenantSlug: string;
};
}
export interface SignupRequest {
tenantName: string;
tenantSlug: string;
email: string;
password: string;
}
export type SignupResponse = LoginResponse;
export interface AdminProfile {
id: string;
email: string;
role: AdminRole;
tenantId: string;
tenantSlug: string;
}
+35
View File
@@ -0,0 +1,35 @@
export type BotStatus = 'ACTIVE' | 'DISCONNECTED' | 'BANNED' | 'PAIRING';
export interface BotSummary {
id: string;
platform: string;
jid: string | null;
displayName: string | null;
status: BotStatus;
isBot: boolean;
createdAt: string;
updatedAt: string;
}
export interface BotInitiateResponse {
pairingToken: string;
expiresAt: string;
qrDataUrl: string | null;
}
export interface BotAttachResponse {
attached: true;
bot: BotSummary;
}
export interface BotQrResponse {
status: BotStatus;
qrDataUrl: string | null;
pairingToken: string;
expiresAt: string;
}
export interface BotRevealResponse {
jid: string;
revealedAt: string;
}
+4
View File
@@ -1 +1,5 @@
export * from './auth';
export * from './message';
export * from './bot';
export * from './onboarding';
export * from './rule';
+4
View File
@@ -59,6 +59,7 @@ export interface SyncRoute {
}
export interface IngestJobData {
tenantId: string;
platformMsgId: string;
platform: Platform;
accountId: string; // which bot account received this message
@@ -67,9 +68,11 @@ export interface IngestJobData {
senderName?: string;
content: string;
tags: string[];
effectiveAction?: 'FLAG' | 'AUTO_APPROVE' | 'SKIP' | 'REJECT';
}
export interface ForwardJobData {
tenantId: string;
messageId: string; // DB id of the approved Message record
content: string;
sourceGroupName: string;
@@ -79,6 +82,7 @@ export interface ForwardJobData {
}
export interface IndexJobData {
tenantId: string;
messageId: string; // DB Message.id (cuid)
content: string;
senderName: string | null;
+86
View File
@@ -0,0 +1,86 @@
export type ConsentScope = 'INGEST' | 'ARCHIVE' | 'REPLICATE' | 'DISPLAY';
export type ConsentStatus = 'GRANTED' | 'REVOKED';
export type MemberOptOutReason = 'STOP_KEYWORD' | 'SELF_PORTAL' | 'ADMIN_ACTION';
export interface OnboardingTokenPayload {
groupId: string;
jid: string;
tenantId: string;
iat?: number;
exp?: number;
}
export interface PublicOnboardInfo {
groupName: string;
tenantName: string;
policyVersion: string;
defaultScopes: ConsentScope[];
defaultRetentionDays: number;
}
export interface RequestOtpRequest {
onboardingToken: string;
phone: string;
}
export interface RequestOtpResponse {
ok: true;
challengeId: string;
expiresInSeconds: number;
}
export interface VerifyOtpRequest {
onboardingToken: string;
challengeId: string;
phone: string;
code: string;
scopes: ConsentScope[];
retentionDays?: number;
}
export interface VerifyOtpResponse {
memberToken: string;
user: {
id: string;
tenantId: string;
jid: string;
displayName: string | null;
};
consent: {
scopes: ConsentScope[];
retentionDays: number;
policyVersion: string;
};
}
export interface MemberProfile {
id: string;
tenantId: string;
jid: string;
displayName: string | null;
createdAt: string;
}
export interface MemberGroupSummary {
id: string;
name: string;
tenantId: string;
scopes: ConsentScope[];
retentionDays: number;
policyVersion: string;
consentStatus: ConsentStatus;
joinedAt: string;
}
export interface OptOutRequest {
groupId?: string;
scopes?: ConsentScope[];
reason?: MemberOptOutReason;
notes?: string;
}
export interface OptInRequest {
groupId: string;
scopes: ConsentScope[];
retentionDays?: number;
}
+31
View File
@@ -0,0 +1,31 @@
export type RuleMatchType = 'HASHTAG' | 'PREFIX' | 'REACTION_EMOJI';
export type RuleAction = 'FLAG' | 'AUTO_APPROVE' | 'SKIP' | 'REJECT';
export interface TenantRuleData {
id: string;
tenantId: string;
matchType: RuleMatchType;
matchValue: string;
action: RuleAction;
priority: number;
isActive: boolean;
createdAt: string;
updatedAt: string;
}
export interface CreateRuleRequest {
matchType: RuleMatchType;
matchValue: string;
action: RuleAction;
priority?: number;
isActive?: boolean;
}
export interface UpdateRuleRequest {
matchType?: RuleMatchType;
matchValue?: string;
action?: RuleAction;
priority?: number;
isActive?: boolean;
}