mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat(BE-36,37,38,39): finish master data management api
This commit is contained in:
@@ -56,4 +56,10 @@ func To{{Pascal .Entity}}ListDTOs(e []entity.{{Pascal .Entity}}) []{{Pascal .Ent
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func To{{Pascal .Entity}}DetailDTO(e entity.{{Pascal .Entity}}) {{Pascal .Entity}}DetailDTO {
|
||||
return {{Pascal .Entity}}DetailDTO{
|
||||
{{Pascal .Entity}}ListDTO: To{{Pascal .Entity}}ListDTO(e),
|
||||
}
|
||||
}
|
||||
{{end}}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
type {{Pascal .Entity}} struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"not null"`
|
||||
Name string `gorm:"not null;uniqueIndex:idx_name,where:deleted_at IS NULL"`
|
||||
CreatedBy uint `gorm:"not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
@@ -88,7 +88,7 @@ func (s *{{Camel .Entity}}Service) CreateOne(c *fiber.Ctx, req *validation.Creat
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return createBody, nil
|
||||
return s.GetOne(c, createBody.Id)
|
||||
}
|
||||
|
||||
func (s {{Camel .Entity}}Service) UpdateOne(c *fiber.Ctx, req *validation.Update, id uint) (*entity.{{Pascal .Entity}}, error) {
|
||||
|
||||
@@ -5,7 +5,7 @@ type Create struct {
|
||||
}
|
||||
|
||||
type Update struct {
|
||||
Name *string `json:"name,omitempty" validate:"omitempty,max=50"`
|
||||
Name *string `json:"name,omitempty" validate:"omitempty"`
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
|
||||
Reference in New Issue
Block a user