feat: Add database object models and repositories for Activity, Company, Customer, Project, TimeEntry, and User with GORM integration
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package dbo
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ActivityDBO struct {
|
||||
gorm.Model
|
||||
ID ulid.ULID `gorm:"primaryKey;type:uuid"`
|
||||
CreatedAt time.Time `gorm:"not null"`
|
||||
UpdatedAt time.Time `gorm:"not null"`
|
||||
LastEditorID ulid.ULID
|
||||
Name string `gorm:"type:varchar(255);not null"`
|
||||
BillingRate float64 `gorm:"type:decimal(10,2)"`
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package dbo
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type CompanyDBO struct {
|
||||
gorm.Model
|
||||
ID ulid.ULID `gorm:"primaryKey;type:uuid"`
|
||||
CreatedAt time.Time `gorm:"not null"`
|
||||
UpdatedAt time.Time `gorm:"not null"`
|
||||
LastEditorID ulid.ULID
|
||||
Name string `gorm:"type:varchar(255);not null"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package dbo
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type CustomerDBO struct {
|
||||
gorm.Model
|
||||
ID ulid.ULID `gorm:"primaryKey;type:uuid"`
|
||||
CreatedAt time.Time `gorm:"not null"`
|
||||
UpdatedAt time.Time `gorm:"not null"`
|
||||
LastEditorID ulid.ULID
|
||||
Name string `gorm:"type:varchar(255);not null"`
|
||||
CompanyID int
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package dbo
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ProjectDBO struct {
|
||||
gorm.Model
|
||||
ID ulid.ULID `gorm:"primaryKey;type:uuid"`
|
||||
CreatedAt time.Time `gorm:"not null"`
|
||||
UpdatedAt time.Time `gorm:"not null"`
|
||||
LastEditorID ulid.ULID
|
||||
Name string `gorm:"type:varchar(255);not null"`
|
||||
CustomerID int
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package dbo
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type TimeEntryDBO struct {
|
||||
gorm.Model
|
||||
ID ulid.ULID `gorm:"primaryKey;type:uuid"`
|
||||
CreatedAt time.Time `gorm:"not null"`
|
||||
UpdatedAt time.Time `gorm:"not null"`
|
||||
LastEditorID ulid.ULID
|
||||
UserID int
|
||||
ProjectID int
|
||||
ActivityID int
|
||||
Start time.Time
|
||||
End time.Time
|
||||
Description string
|
||||
Billable int // Percentage (0-100)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package dbo
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/oklog/ulid/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type UserDBO struct {
|
||||
gorm.Model
|
||||
ID ulid.ULID `gorm:"primaryKey;type:uuid"`
|
||||
CreatedAt time.Time `gorm:"not null"`
|
||||
UpdatedAt time.Time `gorm:"not null"`
|
||||
LastEditorID ulid.ULID
|
||||
Username string
|
||||
Password string
|
||||
Role string
|
||||
CompanyID int
|
||||
HourlyRate float64
|
||||
}
|
||||
Reference in New Issue
Block a user