重构dto
This commit is contained in:
48
internal/app/dto/pig_farm_dto.go
Normal file
48
internal/app/dto/pig_farm_dto.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package dto
|
||||
|
||||
import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
|
||||
|
||||
// PigHouseResponse 定义了猪舍信息的响应结构
|
||||
type PigHouseResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// PenResponse 定义了猪栏信息的响应结构
|
||||
type PenResponse struct {
|
||||
ID uint `json:"id"`
|
||||
PenNumber string `json:"pen_number"`
|
||||
HouseID uint `json:"house_id"`
|
||||
Capacity int `json:"capacity"`
|
||||
Status models.PenStatus `json:"status"`
|
||||
PigBatchID uint `json:"pig_batch_id"`
|
||||
}
|
||||
|
||||
// CreatePigHouseRequest 定义了创建猪舍的请求结构
|
||||
type CreatePigHouseRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// UpdatePigHouseRequest 定义了更新猪舍的请求结构
|
||||
type UpdatePigHouseRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// CreatePenRequest 定义了创建猪栏的请求结构
|
||||
type CreatePenRequest struct {
|
||||
PenNumber string `json:"pen_number" binding:"required"`
|
||||
HouseID uint `json:"house_id" binding:"required"`
|
||||
Capacity int `json:"capacity" binding:"required"`
|
||||
Status models.PenStatus `json:"status" binding:"required"`
|
||||
}
|
||||
|
||||
// UpdatePenRequest 定义了更新猪栏的请求结构
|
||||
type UpdatePenRequest struct {
|
||||
PenNumber string `json:"pen_number" binding:"required"`
|
||||
HouseID uint `json:"house_id" binding:"required"`
|
||||
Capacity int `json:"capacity" binding:"required"`
|
||||
Status models.PenStatus `json:"status" binding:"required"`
|
||||
}
|
||||
Reference in New Issue
Block a user