61 lines
1.7 KiB
Go
61 lines
1.7 KiB
Go
package dto
|
|
|
|
import (
|
|
"strings"
|
|
"time"
|
|
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/pkg/consts"
|
|
|
|
"go.ipao.vip/gen/types"
|
|
)
|
|
|
|
type UserTenantPageFilter struct {
|
|
requests.Pagination `json:",inline" query:",inline"`
|
|
|
|
TenantID *int64 `json:"tenant_id,omitempty" query:"tenant_id"`
|
|
Code *string `json:"code,omitempty" query:"code"`
|
|
Name *string `json:"name,omitempty" query:"name"`
|
|
|
|
// Role filters tenant_users.role containing a role (tenant_admin/member).
|
|
Role *consts.TenantUserRole `json:"role,omitempty" query:"role"`
|
|
// Status filters tenant_users.status.
|
|
Status *consts.UserStatus `json:"status,omitempty" query:"status"`
|
|
|
|
CreatedAtFrom *time.Time `json:"created_at_from,omitempty" query:"created_at_from"`
|
|
CreatedAtTo *time.Time `json:"created_at_to,omitempty" query:"created_at_to"`
|
|
}
|
|
|
|
func (f *UserTenantPageFilter) CodeTrimmed() string {
|
|
if f == nil || f.Code == nil {
|
|
return ""
|
|
}
|
|
return strings.ToLower(strings.TrimSpace(*f.Code))
|
|
}
|
|
|
|
func (f *UserTenantPageFilter) NameTrimmed() string {
|
|
if f == nil || f.Name == nil {
|
|
return ""
|
|
}
|
|
return strings.TrimSpace(*f.Name)
|
|
}
|
|
|
|
type UserTenantItem struct {
|
|
TenantID int64 `json:"tenant_id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
|
|
TenantStatus consts.TenantStatus `json:"tenant_status"`
|
|
TenantStatusDescription string `json:"tenant_status_description,omitempty"`
|
|
ExpiredAt time.Time `json:"expired_at"`
|
|
|
|
Owner *TenantOwnerUserLite `json:"owner,omitempty"`
|
|
|
|
Role types.Array[consts.TenantUserRole] `json:"role"`
|
|
|
|
MemberStatus consts.UserStatus `json:"member_status"`
|
|
MemberStatusDescription string `json:"member_status_description,omitempty"`
|
|
|
|
JoinedAt time.Time `json:"joined_at"`
|
|
}
|