Merge pull request 'make fishbone ID includes' (#32) from feature/responses-v2 into dev

Reviewed-on: winter-access/backend_nam#32
This commit is contained in:
areeqakbr 2025-06-23 10:02:01 +00:00
commit c1b513ca68
2 changed files with 12 additions and 4 deletions

View File

@ -12,6 +12,8 @@ type FishboneResponse struct {
BackboneCode string `json:"backbone_code"` BackboneCode string `json:"backbone_code"`
DeviceStart string `json:"device_start"` DeviceStart string `json:"device_start"`
DeviceEnd string `json:"device_end"` DeviceEnd string `json:"device_end"`
DeviceStartID uuid.UUID `json:"device_start_id"`
DeviceEndID uuid.UUID `json:"device_end_id"`
CoreAmount int `json:"core_amount"` CoreAmount int `json:"core_amount"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
@ -20,7 +22,9 @@ type FishboneResponse struct {
type FishboneDetailResponse struct { type FishboneDetailResponse struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
FishboneCode string `json:"fishbone_code"` FishboneCode string `json:"fishbone_code"`
Backbone BackboneInfo `json:"backbone"` DeviceStartID uuid.UUID `json:"device_start_id"`
DeviceEndID uuid.UUID `json:"device_end_id"`
BackboneCode string `json:"backbone_code"`
CoreAmount int `json:"core_amount"` CoreAmount int `json:"core_amount"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`

View File

@ -18,6 +18,8 @@ func ConvertToFishboneResponses(fishbones []entity.Fishbone, totalFishbone map[u
BackboneCode: fishbone.Backbone.BackboneCode, BackboneCode: fishbone.Backbone.BackboneCode,
DeviceStart: fishbone.DeviceStart.DeviceCode, DeviceStart: fishbone.DeviceStart.DeviceCode,
DeviceEnd: fishbone.DeviceEnd.DeviceCode, DeviceEnd: fishbone.DeviceEnd.DeviceCode,
DeviceStartID: fishbone.DeviceStart.ID,
DeviceEndID: fishbone.DeviceEnd.ID,
CoreAmount: fishbone.CoreAmount, CoreAmount: fishbone.CoreAmount,
CreatedAt: fishbone.CreatedAt, CreatedAt: fishbone.CreatedAt,
UpdatedAt: fishbone.UpdatedAt, UpdatedAt: fishbone.UpdatedAt,
@ -33,9 +35,9 @@ func ConvertToFishboneDetailResponse(fishbone entity.Fishbone) res.FishboneDetai
return res.FishboneDetailResponse{ return res.FishboneDetailResponse{
ID: fishbone.ID, ID: fishbone.ID,
FishboneCode: fishbone.FishboneCode, FishboneCode: fishbone.FishboneCode,
Backbone: res.BackboneInfo{ DeviceStartID: fishbone.DeviceStart.ID,
BackboneCode: fishbone.Backbone.BackboneCode,// Fixed missing field DeviceEndID: fishbone.DeviceEnd.ID,
}, BackboneCode: fishbone.Backbone.BackboneCode,
CoreAmount: fishbone.CoreAmount, CoreAmount: fishbone.CoreAmount,
CreatedAt: fishbone.CreatedAt, CreatedAt: fishbone.CreatedAt,
UpdatedAt: fishbone.UpdatedAt, UpdatedAt: fishbone.UpdatedAt,
@ -53,6 +55,8 @@ func ConvertToSimpleFishboneResponses(fishbones []entity.Fishbone) []res.Fishbon
BackboneCode: fishbone.Backbone.BackboneCode, BackboneCode: fishbone.Backbone.BackboneCode,
DeviceStart: fishbone.DeviceStart.DeviceCode, DeviceStart: fishbone.DeviceStart.DeviceCode,
DeviceEnd: fishbone.DeviceEnd.DeviceCode, DeviceEnd: fishbone.DeviceEnd.DeviceCode,
DeviceStartID: fishbone.DeviceStart.ID,
DeviceEndID: fishbone.DeviceEnd.ID,
CoreAmount: fishbone.CoreAmount, CoreAmount: fishbone.CoreAmount,
CreatedAt: fishbone.CreatedAt, CreatedAt: fishbone.CreatedAt,
UpdatedAt: fishbone.UpdatedAt, UpdatedAt: fishbone.UpdatedAt,