feat: Add example values to DTOs for improved API documentation
This commit is contained in:
@@ -5,24 +5,24 @@ import (
|
||||
)
|
||||
|
||||
type ActivityDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
LastEditorID string `json:"lastEditorID"`
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
ID string `json:"id" example:"a1b2c3d4e5f6"`
|
||||
CreatedAt time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID string `json:"lastEditorID" example:"u1v2w3x4y5z6"`
|
||||
Name string `json:"name" example:"Development"`
|
||||
BillingRate float64 `json:"billingRate" example:"100.00"`
|
||||
}
|
||||
|
||||
type ActivityCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
Name string `json:"name" example:"Development"`
|
||||
BillingRate float64 `json:"billingRate" example:"100.00"`
|
||||
}
|
||||
|
||||
type ActivityUpdateDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
LastEditorID *string `json:"lastEditorID"`
|
||||
Name *string `json:"name"`
|
||||
BillingRate *float64 `json:"billingRate"`
|
||||
ID string `json:"id" example:"a1b2c3d4e5f6"`
|
||||
CreatedAt *time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt *time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID *string `json:"lastEditorID" example:"u1v2w3x4y5z6"`
|
||||
Name *string `json:"name" example:"Development"`
|
||||
BillingRate *float64 `json:"billingRate" example:"100.00"`
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package dto
|
||||
|
||||
// LoginDto represents the login request
|
||||
type LoginDto struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Email string `json:"email" example:"admin@example.com"`
|
||||
Password string `json:"password" example:"Admin@123456"`
|
||||
}
|
||||
|
||||
// TokenDto represents the response after successful authentication
|
||||
type TokenDto struct {
|
||||
Token string `json:"token"`
|
||||
Token string `json:"token" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"`
|
||||
User UserDto `json:"user"`
|
||||
}
|
||||
|
||||
@@ -5,21 +5,21 @@ import (
|
||||
)
|
||||
|
||||
type CompanyDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
LastEditorID string `json:"lastEditorID"`
|
||||
Name string `json:"name"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Name string `json:"name" example:"Acme Corp"`
|
||||
}
|
||||
|
||||
type CompanyCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
Name string `json:"name" example:"Acme Corp"`
|
||||
}
|
||||
|
||||
type CompanyUpdateDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
LastEditorID *string `json:"lastEditorID"`
|
||||
Name *string `json:"name"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt *time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt *time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID *string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Name *string `json:"name" example:"Acme Corp"`
|
||||
}
|
||||
|
||||
@@ -5,24 +5,24 @@ import (
|
||||
)
|
||||
|
||||
type CustomerDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
LastEditorID string `json:"lastEditorID"`
|
||||
Name string `json:"name"`
|
||||
CompanyID string `json:"companyId"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Name string `json:"name" example:"John Doe"`
|
||||
CompanyID string `json:"companyId" example:"01HGW2BBG0000000000000000"`
|
||||
}
|
||||
|
||||
type CustomerCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
CompanyID string `json:"companyId"`
|
||||
Name string `json:"name" example:"John Doe"`
|
||||
CompanyID string `json:"companyId" example:"01HGW2BBG0000000000000000"`
|
||||
}
|
||||
|
||||
type CustomerUpdateDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
LastEditorID *string `json:"lastEditorID"`
|
||||
Name *string `json:"name"`
|
||||
CompanyID *string `json:"companyId"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt *time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt *time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID *string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Name *string `json:"name" example:"John Doe"`
|
||||
CompanyID *string `json:"companyId" example:"01HGW2BBG0000000000000000"`
|
||||
}
|
||||
|
||||
@@ -5,24 +5,24 @@ import (
|
||||
)
|
||||
|
||||
type ProjectDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
LastEditorID string `json:"lastEditorID"`
|
||||
Name string `json:"name"`
|
||||
CustomerID string `json:"customerId"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Name string `json:"name" example:"Time Tracking App"`
|
||||
CustomerID string `json:"customerId" example:"01HGW2BBG0000000000000000"`
|
||||
}
|
||||
|
||||
type ProjectCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
CustomerID string `json:"customerId"`
|
||||
Name string `json:"name" example:"Time Tracking App"`
|
||||
CustomerID string `json:"customerId" example:"01HGW2BBG0000000000000000"`
|
||||
}
|
||||
|
||||
type ProjectUpdateDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
LastEditorID *string `json:"lastEditorID"`
|
||||
Name *string `json:"name"`
|
||||
CustomerID *string `json:"customerId"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt *time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt *time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID *string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Name *string `json:"name" example:"Time Tracking App"`
|
||||
CustomerID *string `json:"customerId" example:"01HGW2BBG0000000000000000"`
|
||||
}
|
||||
|
||||
@@ -5,39 +5,39 @@ import (
|
||||
)
|
||||
|
||||
type TimeEntryDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
LastEditorID string `json:"lastEditorID"`
|
||||
UserID string `json:"userId"`
|
||||
ProjectID string `json:"projectId"`
|
||||
ActivityID string `json:"activityId"`
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
Description string `json:"description"`
|
||||
Billable int `json:"billable"` // Percentage (0-100)
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
UserID string `json:"userId" example:"01HGW2BBG0000000000000000"`
|
||||
ProjectID string `json:"projectId" example:"01HGW2BBG0000000000000000"`
|
||||
ActivityID string `json:"activityId" example:"01HGW2BBG0000000000000000"`
|
||||
Start time.Time `json:"start" example:"2024-01-01T08:00:00Z"`
|
||||
End time.Time `json:"end" example:"2024-01-01T17:00:00Z"`
|
||||
Description string `json:"description" example:"Working on the Time Tracking App"`
|
||||
Billable int `json:"billable" example:"100"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryCreateDto struct {
|
||||
UserID string `json:"userId"`
|
||||
ProjectID string `json:"projectId"`
|
||||
ActivityID string `json:"activityId"`
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
Description string `json:"description"`
|
||||
Billable int `json:"billable"` // Percentage (0-100)
|
||||
UserID string `json:"userId" example:"01HGW2BBG0000000000000000"`
|
||||
ProjectID string `json:"projectId" example:"01HGW2BBG0000000000000000"`
|
||||
ActivityID string `json:"activityId" example:"01HGW2BBG0000000000000000"`
|
||||
Start time.Time `json:"start" example:"2024-01-01T08:00:00Z"`
|
||||
End time.Time `json:"end" example:"2024-01-01T17:00:00Z"`
|
||||
Description string `json:"description" example:"Working on the Time Tracking App"`
|
||||
Billable int `json:"billable" example:"100"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryUpdateDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
LastEditorID *string `json:"lastEditorID"`
|
||||
UserID *string `json:"userId"`
|
||||
ProjectID *string `json:"projectId"`
|
||||
ActivityID *string `json:"activityId"`
|
||||
Start *time.Time `json:"start"`
|
||||
End *time.Time `json:"end"`
|
||||
Description *string `json:"description"`
|
||||
Billable *int `json:"billable"` // Percentage (0-100)
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt *time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt *time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID *string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
UserID *string `json:"userId" example:"01HGW2BBG0000000000000000"`
|
||||
ProjectID *string `json:"projectId" example:"01HGW2BBG0000000000000000"`
|
||||
ActivityID *string `json:"activityId" example:"01HGW2BBG0000000000000000"`
|
||||
Start *time.Time `json:"start" example:"2024-01-01T08:00:00Z"`
|
||||
End *time.Time `json:"end" example:"2024-01-01T17:00:00Z"`
|
||||
Description *string `json:"description" example:"Working on the Time Tracking App"`
|
||||
Billable *int `json:"billable" example:"100"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
@@ -5,32 +5,32 @@ import (
|
||||
)
|
||||
|
||||
type UserDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
LastEditorID string `json:"lastEditorID"`
|
||||
Email string `json:"email"`
|
||||
Role string `json:"role"`
|
||||
CompanyID string `json:"companyId"`
|
||||
HourlyRate float64 `json:"hourlyRate"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Email string `json:"email" example:"test@example.com"`
|
||||
Role string `json:"role" example:"admin"`
|
||||
CompanyID string `json:"companyId" example:"01HGW2BBG0000000000000000"`
|
||||
HourlyRate float64 `json:"hourlyRate" example:"50.00"`
|
||||
}
|
||||
|
||||
type UserCreateDto struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Role string `json:"role"`
|
||||
CompanyID string `json:"companyId"`
|
||||
HourlyRate float64 `json:"hourlyRate"`
|
||||
Email string `json:"email" example:"test@example.com"`
|
||||
Password string `json:"password" example:"password123"`
|
||||
Role string `json:"role" example:"admin"`
|
||||
CompanyID string `json:"companyId" example:"01HGW2BBG0000000000000000"`
|
||||
HourlyRate float64 `json:"hourlyRate" example:"50.00"`
|
||||
}
|
||||
|
||||
type UserUpdateDto struct {
|
||||
ID string `json:"id"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
LastEditorID *string `json:"lastEditorID"`
|
||||
Email *string `json:"email"`
|
||||
Password *string `json:"password"`
|
||||
Role *string `json:"role"`
|
||||
CompanyID *string `json:"companyId"`
|
||||
HourlyRate *float64 `json:"hourlyRate"`
|
||||
ID string `json:"id" example:"01HGW2BBG0000000000000000"`
|
||||
CreatedAt *time.Time `json:"createdAt" example:"2024-01-01T00:00:00Z"`
|
||||
UpdatedAt *time.Time `json:"updatedAt" example:"2024-01-01T00:00:00Z"`
|
||||
LastEditorID *string `json:"lastEditorID" example:"01HGW2BBG0000000000000000"`
|
||||
Email *string `json:"email" example:"test@example.com"`
|
||||
Password *string `json:"password" example:"password123"`
|
||||
Role *string `json:"role" example:"admin"`
|
||||
CompanyID *string `json:"companyId" example:"01HGW2BBG0000000000000000"`
|
||||
HourlyRate *float64 `json:"hourlyRate" example:"50.00"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user