init db with migration, create users table

This commit is contained in:
Paul Coral
2025-07-28 08:16:34 +02:00
parent 8b327dcb18
commit c3881d7ff7
24 changed files with 494 additions and 23 deletions

View File

@@ -0,0 +1,10 @@
export interface AuthApiService {
postCredentials(): Promise<string>;
}
export const AuthApiService: Record<keyof AuthApiService, string> & {
baseUrl: string;
} = {
baseUrl: "auth",
postCredentials: "credentials",
};

View File

@@ -0,0 +1 @@
export * from "./auth-api-service";

View File

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

View File

@@ -1 +1,2 @@
export * from "./contracts/index";
export * from "./api-services";
export * from "./models";

View File

@@ -0,0 +1,14 @@
import z from "zod";
export const credentialAuthParser = z.object({
email: z.string().email({ message: "invalid email" }),
password: z.string({ message: "invalid password" }),
});
export const credentialAuthResponse = z.object({
accessToken: z.string({ message: "invalid access tokens" }),
});
export type CredentialAuth = z.infer<typeof credentialAuthParser>;
export type CredentialAuthResponse = z.infer<typeof credentialAuthResponse>;

View File

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

View File

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

View File

@@ -0,0 +1,16 @@
import z from "zod";
export enum UserTypeEnum {
Customer = "customer",
Professional = "professional",
}
export const userParser = z.object({
id: z.string({ message: "inavlid user id" }),
firstName: z.string({ message: "invalid user first name" }),
lastName: z.string({ message: "invalid last name" }),
email: z.string().email({ message: "invalid email" }),
type: z.nativeEnum(UserTypeEnum, { message: "invalid user type" }),
});
export type User = z.infer<typeof userParser>;