seahaven-ap/src/api/types.ts

75 lines
1.3 KiB
TypeScript
Raw Normal View History

export type ErrorEnvelope = {
error: {
code: string;
message: string;
correlationId: string;
};
};
export type HealthResponse = {
stage: string;
sha: string;
};
export type MeResponse = {
id: string;
email: string;
name: string;
role: "admin" | "ap_processor" | "approver" | "viewer";
};
export type Vendor = {
id: string;
name: string;
email: string | null;
defaultPaymentMethod: "check" | "ach";
createdAt: string;
updatedAt: string;
};
export type GlAccount = {
id: string;
code: string;
name: string;
createdAt: string;
updatedAt: string;
};
export type Department = {
id: string;
code: string;
name: string;
createdAt: string;
updatedAt: string;
};
export type User = {
id: string;
email: string;
name: string;
role: MeResponse["role"];
createdAt: string;
updatedAt: string;
};
export type ApiPaths = {
"/api/health": {
get: { response: HealthResponse };
};
"/api/me": {
get: { response: MeResponse };
};
"/api/vendors": {
get: { response: { items: Vendor[] } };
};
"/api/gl-accounts": {
get: { response: { items: GlAccount[] } };
};
"/api/departments": {
get: { response: { items: Department[] } };
};
"/api/users": {
get: { response: { items: User[] } };
};
};