mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
add migration;add api create employee
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package entities
|
||||
|
||||
import "time"
|
||||
|
||||
type Employee struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"not null"`
|
||||
IsActive bool `gorm:"not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
EmployeeKandangs []EmployeeKandang `gorm:"foreignKey:EmployeeId;references:Id"`
|
||||
}
|
||||
|
||||
type Employees = Employee
|
||||
|
||||
type EmployeeKandang struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
EmployeeId uint `gorm:"not null"`
|
||||
KandangId uint `gorm:"not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
Employee Employee `gorm:"foreignKey:EmployeeId;references:Id"`
|
||||
Kandang Kandang `gorm:"foreignKey:KandangId;references:Id"`
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Phase struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"not null"`
|
||||
IsActive bool `gorm:"not null;default:true"`
|
||||
Category string `gorm:"type:category_code;not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
|
||||
Activities []PhaseActivity `gorm:"foreignKey:PhaseId;references:Id"`
|
||||
}
|
||||
|
||||
type PhaseActivity struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
PhaseId uint `gorm:"not null"`
|
||||
Name string `gorm:"not null"`
|
||||
Description *string `gorm:"type:text"`
|
||||
TimeType *string `gorm:"type:text"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
Phase Phase `gorm:"foreignKey:PhaseId;references:Id"`
|
||||
}
|
||||
|
||||
type Checklist struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"not null"`
|
||||
Description *string `gorm:"type:text"`
|
||||
PhaseId *uint
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
Phase *Phase `gorm:"foreignKey:PhaseId;references:Id"`
|
||||
}
|
||||
Reference in New Issue
Block a user