feat: Replace int IDs with ulid.ULID in domain entities and update TypeScript DTOs
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Activity struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
BillingRate float64
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Company struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Customer struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
CompanyID int
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type Project struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Name string
|
||||
CustomerID int
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package entities
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type TimeEntry struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
UserID int
|
||||
ProjectID int
|
||||
ActivityID int
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package entities
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type User struct {
|
||||
ID int
|
||||
ID ulid.ULID
|
||||
Username string
|
||||
Password string
|
||||
Role string
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type ActivityDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
BillingRate float64 `json:"billingRate"`
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type CompanyDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type CustomerDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CompanyID int `json:"companyId"`
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package dto
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type ProjectDto struct {
|
||||
ID ulid.ULID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CustomerID int `json:"customerId"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
)
|
||||
|
||||
type TimeEntryDto 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,62 +0,0 @@
|
||||
// Code generated by tygo. DO NOT EDIT.
|
||||
|
||||
//////////
|
||||
// source: activity.go
|
||||
|
||||
export interface Activity {
|
||||
ID: number /* int */;
|
||||
Name: string;
|
||||
BillingRate: number /* float64 */;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: company.go
|
||||
|
||||
export interface Company {
|
||||
ID: number /* int */;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: customer.go
|
||||
|
||||
export interface Customer {
|
||||
ID: number /* int */;
|
||||
Name: string;
|
||||
CompanyID: number /* int */;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: project.go
|
||||
|
||||
export interface Project {
|
||||
ID: number /* int */;
|
||||
Name: string;
|
||||
CustomerID: number /* int */;
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: timeentry.go
|
||||
|
||||
export interface TimeEntry {
|
||||
ID: number /* int */;
|
||||
UserID: number /* int */;
|
||||
ProjectID: number /* int */;
|
||||
ActivityID: number /* int */;
|
||||
Start: string;
|
||||
End: string;
|
||||
Description: string;
|
||||
Billable: number /* int */; // Percentage (0-100)
|
||||
}
|
||||
|
||||
//////////
|
||||
// source: user.go
|
||||
|
||||
export interface User {
|
||||
ID: number /* int */;
|
||||
Username: string;
|
||||
Password: string;
|
||||
Role: string;
|
||||
CompanyID: number /* int */;
|
||||
HourlyRate: number /* float64 */;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dto
|
||||
|
||||
import "github.com/oklog/ulid/v2"
|
||||
|
||||
type UserDto 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