init: lab project bootstrapped from isletmem-kovakcrm
- CRM domain modules removed (customers, services, software, calendar, tasks, invoices, leads, finance, etc.)
- DLS branding: package name=lab, logo wordmark, sidebar nav, header CTA
- Tenant layer extended with kind dimension (lab|clinic) + requireTenantKind helper
- Schema rewritten for DLS domain: jobs, job_files, job_status_history, prosthetics, connections, finance_entries, notifications
- Onboarding form: clinic/lab account-type selection + auto-generated memberNumber
- Placeholder routes for jobs/{inbound,outbound,new}, products, finance, connections
- PDF spec + spec.md under belgeler/
- db: lab database + 13 collections + indexes + storage bucket (job-files) provisioned via Appwrite MCP
Ref: belgeler/dls-ui-tasarim.pdf
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
export const DATABASE_ID = "lab";
|
||||
|
||||
export const BUCKETS = {
|
||||
tenantLogos: "tenant-logos",
|
||||
jobFiles: "job-files",
|
||||
} as const;
|
||||
|
||||
export const TABLES = {
|
||||
tenantSettings: "tenant_settings",
|
||||
profiles: "profiles",
|
||||
connections: "connections",
|
||||
jobs: "jobs",
|
||||
jobFiles: "job_files",
|
||||
jobStatusHistory: "job_status_history",
|
||||
prosthetics: "prosthetics",
|
||||
financeEntries: "finance_entries",
|
||||
notifications: "notifications",
|
||||
auditLogs: "audit_logs",
|
||||
inviteLinks: "invite_links",
|
||||
passwordResets: "password_resets",
|
||||
userPreferences: "user_preferences",
|
||||
} as const;
|
||||
|
||||
export type TableId = (typeof TABLES)[keyof typeof TABLES];
|
||||
|
||||
export type SystemRow = {
|
||||
$id: string;
|
||||
$createdAt: string;
|
||||
$updatedAt: string;
|
||||
$permissions: string[];
|
||||
$databaseId?: string;
|
||||
$tableId?: string;
|
||||
$sequence?: number;
|
||||
};
|
||||
|
||||
type Row = SystemRow;
|
||||
|
||||
export type TenantRole = "owner" | "admin" | "member";
|
||||
export type TenantKind = "lab" | "clinic";
|
||||
|
||||
export interface TenantSettings extends Row {
|
||||
tenantId: string;
|
||||
kind: TenantKind;
|
||||
memberNumber: string;
|
||||
companyName: string;
|
||||
companyTaxId?: string;
|
||||
companyAddress?: string;
|
||||
companyEmail?: string;
|
||||
companyPhone?: string;
|
||||
logo?: string;
|
||||
defaultCurrency?: string;
|
||||
}
|
||||
|
||||
export interface Profile extends Row {
|
||||
tenantId: string;
|
||||
userId: string;
|
||||
displayName?: string;
|
||||
phone?: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export type ConnectionStatus = "pending" | "approved" | "rejected";
|
||||
|
||||
export interface Connection extends Row {
|
||||
clinicTenantId: string;
|
||||
labTenantId: string;
|
||||
status: ConnectionStatus;
|
||||
requestedBy: string;
|
||||
requestedAt: string;
|
||||
approvedAt?: string;
|
||||
rejectedAt?: string;
|
||||
}
|
||||
|
||||
export type JobStatus = "pending" | "in_progress" | "sent" | "delivered" | "cancelled";
|
||||
export type JobStep = "olcu" | "alt_yapi_prova" | "ust_yapi_prova" | "cila_bitim";
|
||||
export type ProstheticType =
|
||||
| "metal_porselen"
|
||||
| "zirkonyum"
|
||||
| "implant_ustu_zirkonyum"
|
||||
| "gecici"
|
||||
| "e_max"
|
||||
| "diger";
|
||||
|
||||
export interface Job extends Row {
|
||||
clinicTenantId: string;
|
||||
labTenantId: string;
|
||||
createdBy: string;
|
||||
patientCode: string;
|
||||
prostheticType: ProstheticType;
|
||||
memberCount: number;
|
||||
color?: string;
|
||||
description?: string;
|
||||
price?: number;
|
||||
currency?: string;
|
||||
status: JobStatus;
|
||||
currentStep?: JobStep;
|
||||
dueDate?: string;
|
||||
}
|
||||
|
||||
export type JobFileKind = "scan" | "image" | "document";
|
||||
|
||||
export interface JobFile extends Row {
|
||||
jobId: string;
|
||||
clinicTenantId: string;
|
||||
labTenantId: string;
|
||||
uploadedBy: string;
|
||||
kind: JobFileKind;
|
||||
fileId: string;
|
||||
name: string;
|
||||
size: number;
|
||||
mimeType?: string;
|
||||
}
|
||||
|
||||
export interface JobStatusHistory extends Row {
|
||||
jobId: string;
|
||||
clinicTenantId: string;
|
||||
labTenantId: string;
|
||||
step: JobStep;
|
||||
completedBy: string;
|
||||
completedAt: string;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
export interface Prosthetic extends Row {
|
||||
tenantId: string;
|
||||
createdBy: string;
|
||||
name: string;
|
||||
type: ProstheticType;
|
||||
unitPrice: number;
|
||||
currency?: string;
|
||||
archived?: boolean;
|
||||
}
|
||||
|
||||
export type FinanceType = "income" | "expense" | "receivable" | "payable";
|
||||
export type FinanceStatus = "pending" | "paid" | "cancelled";
|
||||
|
||||
export interface FinanceEntry extends Row {
|
||||
tenantId: string;
|
||||
createdBy: string;
|
||||
jobId?: string;
|
||||
counterpartTenantId?: string;
|
||||
type: FinanceType;
|
||||
amount: number;
|
||||
currency?: string;
|
||||
status: FinanceStatus;
|
||||
date: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface Notification extends Row {
|
||||
tenantId: string;
|
||||
userId?: string;
|
||||
jobId?: string;
|
||||
connectionId?: string;
|
||||
message: string;
|
||||
read: boolean;
|
||||
}
|
||||
|
||||
export type AuditAction = "create" | "update" | "delete";
|
||||
|
||||
export interface AuditLog extends Row {
|
||||
tenantId: string;
|
||||
userId: string;
|
||||
action: AuditAction;
|
||||
entityType: string;
|
||||
entityId: string;
|
||||
changes?: string;
|
||||
ipAddress?: string;
|
||||
userAgent?: string;
|
||||
}
|
||||
|
||||
export type InviteRole = "admin" | "member";
|
||||
export type InviteStatus = "pending" | "accepted" | "cancelled" | "expired";
|
||||
|
||||
export interface InviteLink extends Row {
|
||||
tenantId: string;
|
||||
code: string;
|
||||
email: string;
|
||||
role?: InviteRole;
|
||||
status?: InviteStatus;
|
||||
invitedBy: string;
|
||||
expiresAt?: string;
|
||||
acceptedAt?: string;
|
||||
acceptedBy?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user