feat: Add TypeScript type generation and update DTOs to use string for IDs
This commit is contained in:
parent
016078c1c3
commit
0379ea4ae4
@ -27,6 +27,7 @@ help:
|
|||||||
@echo " make db-reinit - Re-initialize the database"
|
@echo " make db-reinit - Re-initialize the database"
|
||||||
@echo " make swagger - Generate swagger documentation"
|
@echo " make swagger - Generate swagger documentation"
|
||||||
@echo " make help - Show this help message"
|
@echo " make help - Show this help message"
|
||||||
|
@echo "" make generate-ts - Generate TypeScript types
|
||||||
|
|
||||||
# Start the database
|
# Start the database
|
||||||
db-start:
|
db-start:
|
||||||
@ -95,20 +96,9 @@ swagger:
|
|||||||
@swag init -g cmd/api/main.go
|
@swag init -g cmd/api/main.go
|
||||||
@echo "Swagger documentation generated"
|
@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"
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
packages:
|
packages:
|
||||||
- path: github.com/timetracker/backend/dto
|
- path: github.com/timetracker/backend/internal/dtos
|
||||||
type_mappings:
|
type_mappings:
|
||||||
"time.Time": "string"
|
"time.Time": "string"
|
||||||
"ulid.ULID": "string"
|
"ulid.ULID": "string"
|
@ -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
|
|
@ -24,6 +24,24 @@ export interface ActivityUpdateDto {
|
|||||||
billingRate?: number /* float64 */;
|
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
|
// source: company_dto.go
|
||||||
|
|
||||||
@ -54,11 +72,11 @@ export interface CustomerDto {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
lastEditorID: string;
|
lastEditorID: string;
|
||||||
name: string;
|
name: string;
|
||||||
companyId: number /* int */;
|
companyId: string;
|
||||||
}
|
}
|
||||||
export interface CustomerCreateDto {
|
export interface CustomerCreateDto {
|
||||||
name: string;
|
name: string;
|
||||||
companyId: number /* int */;
|
companyId: string;
|
||||||
}
|
}
|
||||||
export interface CustomerUpdateDto {
|
export interface CustomerUpdateDto {
|
||||||
id: string;
|
id: string;
|
||||||
@ -66,7 +84,7 @@ export interface CustomerUpdateDto {
|
|||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
lastEditorID?: string;
|
lastEditorID?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
companyId?: number /* int */;
|
companyId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
@ -78,11 +96,11 @@ export interface ProjectDto {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
lastEditorID: string;
|
lastEditorID: string;
|
||||||
name: string;
|
name: string;
|
||||||
customerId: number /* int */;
|
customerId: string;
|
||||||
}
|
}
|
||||||
export interface ProjectCreateDto {
|
export interface ProjectCreateDto {
|
||||||
name: string;
|
name: string;
|
||||||
customerId: number /* int */;
|
customerId: string;
|
||||||
}
|
}
|
||||||
export interface ProjectUpdateDto {
|
export interface ProjectUpdateDto {
|
||||||
id: string;
|
id: string;
|
||||||
@ -90,7 +108,7 @@ export interface ProjectUpdateDto {
|
|||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
lastEditorID?: string;
|
lastEditorID?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
customerId?: number /* int */;
|
customerId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
@ -101,18 +119,18 @@ export interface TimeEntryDto {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
lastEditorID: string;
|
lastEditorID: string;
|
||||||
userId: number /* int */;
|
userId: string;
|
||||||
projectId: number /* int */;
|
projectId: string;
|
||||||
activityId: number /* int */;
|
activityId: string;
|
||||||
start: string;
|
start: string;
|
||||||
end: string;
|
end: string;
|
||||||
description: string;
|
description: string;
|
||||||
billable: number /* int */; // Percentage (0-100)
|
billable: number /* int */; // Percentage (0-100)
|
||||||
}
|
}
|
||||||
export interface TimeEntryCreateDto {
|
export interface TimeEntryCreateDto {
|
||||||
userId: number /* int */;
|
userId: string;
|
||||||
projectId: number /* int */;
|
projectId: string;
|
||||||
activityId: number /* int */;
|
activityId: string;
|
||||||
start: string;
|
start: string;
|
||||||
end: string;
|
end: string;
|
||||||
description: string;
|
description: string;
|
||||||
@ -123,9 +141,9 @@ export interface TimeEntryUpdateDto {
|
|||||||
createdAt?: string;
|
createdAt?: string;
|
||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
lastEditorID?: string;
|
lastEditorID?: string;
|
||||||
userId?: number /* int */;
|
userId?: string;
|
||||||
projectId?: number /* int */;
|
projectId?: string;
|
||||||
activityId?: number /* int */;
|
activityId?: string;
|
||||||
start?: string;
|
start?: string;
|
||||||
end?: string;
|
end?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
@ -141,16 +159,15 @@ export interface UserDto {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
lastEditorID: string;
|
lastEditorID: string;
|
||||||
email: 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;
|
role: string;
|
||||||
companyId: number /* int */;
|
companyId: string;
|
||||||
hourlyRate: number /* float64 */;
|
hourlyRate: number /* float64 */;
|
||||||
}
|
}
|
||||||
export interface UserCreateDto {
|
export interface UserCreateDto {
|
||||||
email: 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;
|
role: string;
|
||||||
companyId: number /* int */;
|
companyId: string;
|
||||||
hourlyRate: number /* float64 */;
|
hourlyRate: number /* float64 */;
|
||||||
}
|
}
|
||||||
export interface UserUpdateDto {
|
export interface UserUpdateDto {
|
||||||
@ -159,8 +176,8 @@ export interface UserUpdateDto {
|
|||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
lastEditorID?: string;
|
lastEditorID?: string;
|
||||||
email?: 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;
|
role?: string;
|
||||||
companyId?: number /* int */;
|
companyId?: string;
|
||||||
hourlyRate?: number /* float64 */;
|
hourlyRate?: number /* float64 */;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user