feat: Add TypeScript type generation and update DTOs to use string for IDs

This commit is contained in:
Jean Jacques Avril 2025-03-12 06:38:41 +00:00
parent 016078c1c3
commit 0379ea4ae4
4 changed files with 45 additions and 55 deletions

View File

@ -27,6 +27,7 @@ help:
@echo " make db-reinit - Re-initialize the database"
@echo " make swagger - Generate swagger documentation"
@echo " make help - Show this help message"
@echo "" make generate-ts - Generate TypeScript types
# Start the database
db-start:
@ -95,20 +96,9 @@ swagger:
@swag init -g cmd/api/main.go
@echo "Swagger documentation generated"
# Generate TypeScript types
generate-ts:
@echo "Generating TypeScript types..."
@tygo generate
@echo "TypeScript types generated"
help:
@echo "Time Tracker Backend Makefile"
@echo ""
@echo "Usage:"
@echo " make db-start - Start the PostgreSQL database container"
@echo " make db-stop - Stop the PostgreSQL database container"
@echo " make db-test - Test the database connection"
@echo " make model-test - Test the database models"
@echo " make run - Run the application"
@echo " make build - Build the application"
@echo " make clean - Remove build artifacts"
@echo " make migrate - Run database migrations"
@echo " make seed - Seed the database with initial data"
@echo " make db-drop-users - Drop the users table"
@echo " make db-reinit - Re-initialize the database"
@echo " make help - Show this help message"

View File

@ -1,5 +1,5 @@
packages:
- path: github.com/timetracker/backend/dto
- path: github.com/timetracker/backend/internal/dtos
type_mappings:
"time.Time": "string"
"ulid.ULID": "string"

View File

@ -1,17 +0,0 @@
# Deployment and DevOps
## Containerization
- Docker containers for backend and frontend
- Docker Compose for development environment
- Kubernetes manifests for production environment
## CI/CD Pipeline
- Automated tests (Unit, Integration, E2E)
- Automated deployment
- Version management
## Monitoring and Logging
- Prometheus for metrics
- Grafana for visualization
- ELK Stack or similar for logging
- Alerting for critical events

View File

@ -24,6 +24,24 @@ export interface ActivityUpdateDto {
billingRate?: number /* float64 */;
}
//////////
// source: auth_dto.go
/**
* LoginDto represents the login request
*/
export interface LoginDto {
email: string;
password: string;
}
/**
* TokenDto represents the response after successful authentication
*/
export interface TokenDto {
token: string;
user: UserDto;
}
//////////
// source: company_dto.go
@ -54,11 +72,11 @@ export interface CustomerDto {
updatedAt: string;
lastEditorID: string;
name: string;
companyId: number /* int */;
companyId: string;
}
export interface CustomerCreateDto {
name: string;
companyId: number /* int */;
companyId: string;
}
export interface CustomerUpdateDto {
id: string;
@ -66,7 +84,7 @@ export interface CustomerUpdateDto {
updatedAt?: string;
lastEditorID?: string;
name?: string;
companyId?: number /* int */;
companyId?: string;
}
//////////
@ -78,11 +96,11 @@ export interface ProjectDto {
updatedAt: string;
lastEditorID: string;
name: string;
customerId: number /* int */;
customerId: string;
}
export interface ProjectCreateDto {
name: string;
customerId: number /* int */;
customerId: string;
}
export interface ProjectUpdateDto {
id: string;
@ -90,7 +108,7 @@ export interface ProjectUpdateDto {
updatedAt?: string;
lastEditorID?: string;
name?: string;
customerId?: number /* int */;
customerId?: string;
}
//////////
@ -101,18 +119,18 @@ export interface TimeEntryDto {
createdAt: string;
updatedAt: string;
lastEditorID: string;
userId: number /* int */;
projectId: number /* int */;
activityId: number /* int */;
userId: string;
projectId: string;
activityId: string;
start: string;
end: string;
description: string;
billable: number /* int */; // Percentage (0-100)
}
export interface TimeEntryCreateDto {
userId: number /* int */;
projectId: number /* int */;
activityId: number /* int */;
userId: string;
projectId: string;
activityId: string;
start: string;
end: string;
description: string;
@ -123,9 +141,9 @@ export interface TimeEntryUpdateDto {
createdAt?: string;
updatedAt?: string;
lastEditorID?: string;
userId?: number /* int */;
projectId?: number /* int */;
activityId?: number /* int */;
userId?: string;
projectId?: string;
activityId?: string;
start?: string;
end?: string;
description?: string;
@ -141,16 +159,15 @@ export interface UserDto {
updatedAt: string;
lastEditorID: string;
email: string;
password: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
role: string;
companyId: number /* int */;
companyId: string;
hourlyRate: number /* float64 */;
}
export interface UserCreateDto {
email: string;
password: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
password: string;
role: string;
companyId: number /* int */;
companyId: string;
hourlyRate: number /* float64 */;
}
export interface UserUpdateDto {
@ -159,8 +176,8 @@ export interface UserUpdateDto {
updatedAt?: string;
lastEditorID?: string;
email?: string;
password?: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
password?: string;
role?: string;
companyId?: number /* int */;
companyId?: string;
hourlyRate?: number /* float64 */;
}