feat: Add create and update DTOs for Company, Customer, Project, Activity, User, and TimeEntry entities
This commit is contained in:
@@ -9,3 +9,14 @@ type ActivityDto struct {
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
}
|
||||
|
||||
type ActivityCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
}
|
||||
|
||||
type ActivityUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
BillingRate *float64 `json:"billingRate"`
|
||||
}
|
||||
|
||||
@@ -8,3 +8,12 @@ type CompanyDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type CompanyCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type CompanyUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
}
|
||||
|
||||
@@ -9,3 +9,14 @@ type CustomerDto struct {
|
||||
Name string `json:"name"`
|
||||
CompanyID int `json:"companyId"`
|
||||
}
|
||||
|
||||
type CustomerCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
CompanyID int `json:"companyId"`
|
||||
}
|
||||
|
||||
type CustomerUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
CompanyID *int `json:"companyId"`
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package dto
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type ProjectDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CustomerID int `json:"customerId"`
|
||||
}
|
||||
|
||||
type ProjectCreateDto struct {
|
||||
Name string `json:"name"`
|
||||
CustomerID int `json:"customerId"`
|
||||
}
|
||||
|
||||
type ProjectUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
CustomerID *int `json:"customerId"`
|
||||
}
|
||||
|
||||
@@ -16,3 +16,24 @@ type TimeEntryDto struct {
|
||||
Description string `json:"description"`
|
||||
Billable int `json:"billable"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryCreateDto struct {
|
||||
UserID int `json:"userId"`
|
||||
ProjectID int `json:"projectId"`
|
||||
ActivityID int `json:"activityId"`
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
Description string `json:"description"`
|
||||
Billable int `json:"billable"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
type TimeEntryUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
UserID *int `json:"userId"`
|
||||
ProjectID *int `json:"projectId"`
|
||||
ActivityID *int `json:"activityId"`
|
||||
Start *time.Time `json:"start"`
|
||||
End *time.Time `json:"end"`
|
||||
Description *string `json:"description"`
|
||||
Billable *int `json:"billable"` // Percentage (0-100)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package dto
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type UserDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
@@ -10,3 +12,20 @@ type UserDto struct {
|
||||
CompanyID int `json:"companyId"`
|
||||
HourlyRate float64 `json:"hourlyRate"`
|
||||
}
|
||||
|
||||
type UserCreateDto struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
Role string `json:"role"`
|
||||
CompanyID int `json:"companyId"`
|
||||
HourlyRate float64 `json:"hourlyRate"`
|
||||
}
|
||||
|
||||
type UserUpdateDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Username *string `json:"username"`
|
||||
Password *string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
|
||||
Role *string `json:"role"`
|
||||
CompanyID *int `json:"companyId"`
|
||||
HourlyRate *float64 `json:"hourlyRate"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user