feat: add domain models and repositories for user, spool presets, and filaments
- Introduced SpoolPreset and User domain models with necessary DTOs and utility functions. - Created AuthRepository, FilamentRepository, and SpoolPresetRepository interfaces for authentication and data management. - Implemented UI components for filament display, including ColorSwatch, FilamentCard, and StockBar. - Developed layout components such as Header and Screen for consistent app structure. - Added reusable UI components like Badge, Button, Card, and Input for better user interaction. - Established global constants and theme settings for consistent styling across the application. - Implemented utility functions for filament calculations and formatting. - Created Zustand stores for managing authentication, filament, and preset states. - Configured TypeScript settings for improved development experience.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import type { AuthSession, LoginInput, RegisterInput, GoogleOAuthInput } from '@domain/User';
|
||||
|
||||
/**
|
||||
* Contrato para o repositório de autenticação.
|
||||
* Abstrai o transporte (REST) das operações de auth.
|
||||
*/
|
||||
export interface AuthRepository {
|
||||
login(input: LoginInput): Promise<AuthSession>;
|
||||
register(input: RegisterInput): Promise<AuthSession>;
|
||||
loginWithGoogle(input: GoogleOAuthInput): Promise<AuthSession>;
|
||||
refreshToken(refreshToken: string): Promise<Pick<AuthSession, 'accessToken' | 'refreshToken'>>;
|
||||
logout(accessToken: string): Promise<void>;
|
||||
forgotPassword(email: string): Promise<void>;
|
||||
verifyEmail(token: string): Promise<void>;
|
||||
resetPassword(token: string, newPassword: string): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { Filament, CreateFilamentInput, UpdateFilamentInput, FilamentFilter } from '@domain/Filament';
|
||||
|
||||
/**
|
||||
* Contrato que qualquer repositório de filamentos deve implementar.
|
||||
* Tanto o adapter local (SQLite) quanto o remoto (API) implementam esta interface.
|
||||
*/
|
||||
export interface FilamentRepository {
|
||||
findById(id: string, userId: string): Promise<Filament | null>;
|
||||
list(userId: string, filter?: FilamentFilter): Promise<Filament[]>;
|
||||
create(userId: string, input: CreateFilamentInput & { netWeightG: number }): Promise<Filament>;
|
||||
update(id: string, userId: string, input: UpdateFilamentInput & { netWeightG?: number }): Promise<Filament>;
|
||||
remove(id: string, userId: string): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { SpoolPreset, CreateSpoolPresetInput, UpdateSpoolPresetInput } from '@domain/SpoolPreset';
|
||||
|
||||
/**
|
||||
* Contrato que qualquer repositório de presets de carretéis deve implementar.
|
||||
*/
|
||||
export interface SpoolPresetRepository {
|
||||
list(userId: string): Promise<SpoolPreset[]>;
|
||||
findById(id: string): Promise<SpoolPreset | null>;
|
||||
create(userId: string, input: CreateSpoolPresetInput): Promise<SpoolPreset>;
|
||||
update(id: string, userId: string, input: UpdateSpoolPresetInput): Promise<SpoolPreset>;
|
||||
remove(id: string, userId: string): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user