refactor: remove company management APIs
This commit is contained in:
@@ -20,7 +20,6 @@ type User struct {
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
Serials []Serial `gorm:"foreignKey:CreatedBy" json:"-"`
|
||||
EmployeeSerials []EmployeeSerial `gorm:"foreignKey:EmployeeID" json:"employeeSerials,omitempty"`
|
||||
}
|
||||
|
||||
@@ -32,22 +31,6 @@ type Company struct {
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
Serials []Serial `gorm:"foreignKey:CompanyName;references:CompanyName" json:"-"`
|
||||
}
|
||||
|
||||
// Serial 模型
|
||||
type Serial struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
SerialNumber string `gorm:"uniqueIndex;size:255" json:"serialNumber"`
|
||||
CompanyName string `gorm:"index;size:255" json:"companyName"`
|
||||
ValidUntil *time.Time `json:"validUntil"`
|
||||
IsActive bool `gorm:"default:true" json:"isActive"`
|
||||
CreatedBy *uint `json:"createdBy"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
User *User `gorm:"foreignKey:CreatedBy" json:"user,omitempty"`
|
||||
Company *Company `gorm:"foreignKey:CompanyName;references:CompanyName" json:"company,omitempty"`
|
||||
}
|
||||
|
||||
// ProductTrace 产品溯源模型
|
||||
@@ -129,28 +112,6 @@ type AdminResetPasswordDTO struct {
|
||||
NewPassword string `json:"newPassword" validate:"required,min=6"`
|
||||
}
|
||||
|
||||
// GenerateSerialDTO 生成序列号请求数据
|
||||
type GenerateSerialDTO struct {
|
||||
CompanyName string `json:"companyName" validate:"required"`
|
||||
Quantity int `json:"quantity" validate:"min=1,max=1000"`
|
||||
ValidDays int `json:"validDays" validate:"min=1,max=3650"`
|
||||
}
|
||||
|
||||
// GenerateWithPrefixDTO 带前缀生成序列号请求数据
|
||||
type GenerateWithPrefixDTO struct {
|
||||
CompanyName string `json:"companyName" validate:"required"`
|
||||
Quantity int `json:"quantity" validate:"min=1,max=1000"`
|
||||
ValidDays int `json:"validDays" validate:"min=1,max=3650"`
|
||||
SerialPrefix string `json:"serialPrefix" validate:"omitempty,alphanum"`
|
||||
}
|
||||
|
||||
// UpdateSerialDTO 序列号更新请求数据
|
||||
type UpdateSerialDTO struct {
|
||||
CompanyName string `json:"companyName,omitempty" validate:"omitempty"`
|
||||
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
||||
IsActive *bool `json:"isActive,omitempty"`
|
||||
}
|
||||
|
||||
// CreateProductTraceDTO 创建产品溯源请求数据
|
||||
type CreateProductTraceDTO struct {
|
||||
CompanyName string `json:"companyName" validate:"required"`
|
||||
@@ -228,40 +189,6 @@ type QRCodeResponse struct {
|
||||
QueryURL string `json:"queryUrl"`
|
||||
}
|
||||
|
||||
// CompanyResponse 企业响应
|
||||
type CompanyResponse struct {
|
||||
Message string `json:"message"`
|
||||
Company Company `json:"company"`
|
||||
}
|
||||
|
||||
// CompanyDataRequest 企业数据请求
|
||||
type CompanyDataRequest struct {
|
||||
CompanyName string `json:"companyName" validate:"required"`
|
||||
}
|
||||
|
||||
// CompanyUpdateRequest 企业更新请求
|
||||
type CompanyUpdateRequest struct {
|
||||
CompanyName string `json:"companyName"`
|
||||
IsActive *bool `json:"isActive"`
|
||||
}
|
||||
|
||||
// CompanyStatsOverviewDTO 企业统计概览
|
||||
type CompanyStatsOverviewDTO struct {
|
||||
TotalCompanies int64 `json:"totalCompanies"`
|
||||
ActiveCompanies int64 `json:"activeCompanies"`
|
||||
InactiveCompanies int64 `json:"inactiveCompanies"`
|
||||
TotalSerials int64 `json:"totalSerials"`
|
||||
ActiveSerials int64 `json:"activeSerials"`
|
||||
RevokedSerials int64 `json:"revokedSerials"`
|
||||
TotalEmployeeSerials int64 `json:"totalEmployeeSerials"`
|
||||
ActiveEmployeeSerials int64 `json:"activeEmployeeSerials"`
|
||||
RevokedEmployeeSerials int64 `json:"revokedEmployeeSerials"`
|
||||
TotalAftersales int64 `json:"totalAftersales"`
|
||||
PendingConfirmation int64 `json:"pendingConfirmation"`
|
||||
ClosedAftersales int64 `json:"closedAftersales"`
|
||||
RejectedAftersales int64 `json:"rejectedAftersales"`
|
||||
}
|
||||
|
||||
// EmployeeSerial 员工序列号模型
|
||||
type EmployeeSerial struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
|
||||
Reference in New Issue
Block a user