adding backbone code
This commit is contained in:
parent
bc6e1f7398
commit
cde3b652a6
|
|
@ -3,6 +3,7 @@ package req
|
||||||
import "github.com/google/uuid"
|
import "github.com/google/uuid"
|
||||||
|
|
||||||
type BackboneDTO struct {
|
type BackboneDTO struct {
|
||||||
|
BackboneCode string `json:"backbone_code" validate:"required,min=3"`
|
||||||
DeviceStartID uuid.UUID `json:"dev_start_id"`
|
DeviceStartID uuid.UUID `json:"dev_start_id"`
|
||||||
DeviceEndID uuid.UUID `json:"dev_end_id"`
|
DeviceEndID uuid.UUID `json:"dev_end_id"`
|
||||||
CoreAmount int `json:"core_amount"`
|
CoreAmount int `json:"core_amount"`
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
type BackboneResponse struct {
|
type BackboneResponse struct {
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
|
BackboneCode string `json:"backbone_code"`
|
||||||
DevStart string `json:"dev_start"`
|
DevStart string `json:"dev_start"`
|
||||||
DevEnd string `json:"dev_end"`
|
DevEnd string `json:"dev_end"`
|
||||||
CoreAmount int `json:"core_amount"`
|
CoreAmount int `json:"core_amount"`
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
type Backbone struct {
|
type Backbone struct {
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
|
BackboneCode string `json:"backbone_code"`
|
||||||
DeviceStartID uuid.UUID `json:"dev_start_id" gorm:"column:dev_start_id"`
|
DeviceStartID uuid.UUID `json:"dev_start_id" gorm:"column:dev_start_id"`
|
||||||
DeviceEndID uuid.UUID `json:"dev_end_id" gorm:"column:dev_end_id"`
|
DeviceEndID uuid.UUID `json:"dev_end_id" gorm:"column:dev_end_id"`
|
||||||
CoreAmount int `json:"core_amount"`
|
CoreAmount int `json:"core_amount"`
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ func (u *backboneUseCase) CreateBackbone(backbone req.BackboneDTO) error {
|
||||||
return fmt.Errorf("validation error: %w", err)
|
return fmt.Errorf("validation error: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
newBackbone := entity.Backbone{
|
newBackbone := entity.Backbone{
|
||||||
ID: uuid.New(),
|
ID: uuid.New(),
|
||||||
|
BackboneCode: backbone.BackboneCode,
|
||||||
DeviceStartID: backbone.DeviceStartID,
|
DeviceStartID: backbone.DeviceStartID,
|
||||||
DeviceEndID: backbone.DeviceEndID,
|
DeviceEndID: backbone.DeviceEndID,
|
||||||
CoreAmount: backbone.CoreAmount,
|
CoreAmount: backbone.CoreAmount,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ func ConvertToBackboneResponses(backbone []entity.Backbone, totalFishbone map[uu
|
||||||
}
|
}
|
||||||
backboneResp := res.BackboneResponse {
|
backboneResp := res.BackboneResponse {
|
||||||
ID: backbone.ID,
|
ID: backbone.ID,
|
||||||
|
BackboneCode: backbone.BackboneCode,
|
||||||
DevStart: backbone.DeviceStart.DeviceCode,
|
DevStart: backbone.DeviceStart.DeviceCode,
|
||||||
DevEnd: backbone.DeviceEnd.DeviceCode,
|
DevEnd: backbone.DeviceEnd.DeviceCode,
|
||||||
CoreAmount: backbone.CoreAmount,
|
CoreAmount: backbone.CoreAmount,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue