Initial MRP foundation scaffold
This commit is contained in:
17
shared/src/auth/permissions.ts
Normal file
17
shared/src/auth/permissions.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export const permissions = {
|
||||
adminManage: "admin.manage",
|
||||
companyRead: "company.read",
|
||||
companyWrite: "company.write",
|
||||
crmRead: "crm.read",
|
||||
crmWrite: "crm.write",
|
||||
filesRead: "files.read",
|
||||
filesWrite: "files.write",
|
||||
ganttRead: "gantt.read",
|
||||
salesRead: "sales.read",
|
||||
shippingRead: "shipping.read",
|
||||
} as const;
|
||||
|
||||
export type PermissionKey = (typeof permissions)[keyof typeof permissions];
|
||||
|
||||
export const defaultAdminPermissions: PermissionKey[] = Object.values(permissions);
|
||||
|
||||
21
shared/src/auth/types.ts
Normal file
21
shared/src/auth/types.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { PermissionKey } from "./permissions";
|
||||
|
||||
export interface AuthUser {
|
||||
id: string;
|
||||
email: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
roles: string[];
|
||||
permissions: PermissionKey[];
|
||||
}
|
||||
|
||||
export interface LoginRequest {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
token: string;
|
||||
user: AuthUser;
|
||||
}
|
||||
|
||||
15
shared/src/common/api.ts
Normal file
15
shared/src/common/api.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export interface ApiSuccess<T> {
|
||||
ok: true;
|
||||
data: T;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
ok: false;
|
||||
error: {
|
||||
message: string;
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type ApiResponse<T> = ApiSuccess<T> | ApiError;
|
||||
|
||||
29
shared/src/company/types.ts
Normal file
29
shared/src/company/types.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export interface BrandTheme {
|
||||
primaryColor: string;
|
||||
accentColor: string;
|
||||
surfaceColor: string;
|
||||
fontFamily: string;
|
||||
logoFileId: string | null;
|
||||
}
|
||||
|
||||
export interface CompanyProfileDto {
|
||||
id: string;
|
||||
companyName: string;
|
||||
legalName: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
website: string;
|
||||
taxId: string;
|
||||
addressLine1: string;
|
||||
addressLine2: string;
|
||||
city: string;
|
||||
state: string;
|
||||
postalCode: string;
|
||||
country: string;
|
||||
theme: BrandTheme;
|
||||
logoUrl: string | null;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type CompanyProfileInput = Omit<CompanyProfileDto, "id" | "logoUrl" | "updatedAt">;
|
||||
|
||||
11
shared/src/files/types.ts
Normal file
11
shared/src/files/types.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface FileAttachmentDto {
|
||||
id: string;
|
||||
originalName: string;
|
||||
mimeType: string;
|
||||
sizeBytes: number;
|
||||
relativePath: string;
|
||||
ownerType: string;
|
||||
ownerId: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
16
shared/src/gantt/types.ts
Normal file
16
shared/src/gantt/types.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface GanttTaskDto {
|
||||
id: string;
|
||||
text: string;
|
||||
start: string;
|
||||
end: string;
|
||||
progress: number;
|
||||
type: "task" | "project" | "milestone";
|
||||
}
|
||||
|
||||
export interface GanttLinkDto {
|
||||
id: string;
|
||||
source: string;
|
||||
target: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
6
shared/src/index.ts
Normal file
6
shared/src/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./auth/permissions";
|
||||
export * from "./auth/types";
|
||||
export * from "./common/api";
|
||||
export * from "./company/types";
|
||||
export * from "./files/types";
|
||||
export * from "./gantt/types";
|
||||
Reference in New Issue
Block a user