71 lines
1.3 KiB
Go
71 lines
1.3 KiB
Go
package authpartner
|
|
|
|
import (
|
|
// internal - domain - main-entities
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
SecretKey string `json:"secretKey"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
Sort string `json:"sort"`
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Code *string `json:"code"`
|
|
Name *string `json:"name"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id *uint16 `json:"id"`
|
|
Code *string `json:"code"`
|
|
Includes string `json:"includes"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint16 `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.SmallMain
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
SecretKey string `json:"secretKey"`
|
|
}
|
|
|
|
func (d AuthPartner) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Code: d.Code,
|
|
Name: d.Name,
|
|
SecretKey: d.SecretKey,
|
|
}
|
|
resp.SmallMain = d.SmallMain
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []AuthPartner) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|