Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WithAssertion2FA = api.WithMetadataItem("assertion_2fa", admin.Assertion2FA{}) WithAssertionSuperAdmin = api.WithMetadataItem("assertion_sa", admin.AssertionSuperAdmin{}) WithAssertionSuperAdminOrOwner = api.WithMetadataItem("assertion_sa_owner", admin.AssertionSuperAdminOrOwner{}) WithSecurity = api.WithSecurity(Security) WithNoSecurity = func(op *huma.Operation) { op.Security = nil if op.Metadata == nil { return } for _, v := range op.Metadata { switch v := v.(type) { case *rbac.Target: v.Assertions = nil } } } WithNoAssertions = func(op *huma.Operation) { if op.Metadata == nil { return } metadata := make(map[string]any) for k, v := range op.Metadata { switch v := v.(type) { case *rbac.Target: v.Assertions = nil metadata[k] = v case rbac.Assertion, []rbac.Assertion: default: metadata[k] = v } } op.Metadata = metadata } )
View Source
var Info = api.CRUDInfo{Area: "admin", Version: "v1"}
View Source
var Security = []map[string][]string{
{"basic": {}},
{"bearer": {}},
}
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
api.List[model.Admin]
api.Read[model.Admin, int64]
api.Create[CreateAdminBody, model.Admin, int64]
api.Update[UpdateAdminBody, model.Admin, int64]
// contains filtered or unexported fields
}
func NewAdmin ¶
func NewAdmin(r repository.Admin, refreshRepo repository.RefreshToken, errorTransformer api.ErrorTransformerFunc) Admin
type AvatarInput ¶
type AvatarInput struct {
Male int `query:"male,omitempty" required:"false"`
}
type CreateAdminBody ¶
type CreateAdminBody struct {
Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty" required:"true"`
Email string `json:"email,omitempty" yaml:"email,omitempty" required:"true" format:"email" maxLength:"254"`
Username string `json:"username,omitempty" yaml:"username,omitempty" required:"true" minLength:"3" maxLength:"100"`
Password string `json:"password,omitempty" yaml:"password,omitempty" required:"true" minLength:"8" maxLength:"64"`
IsActive bool `json:"isActive,omitempty" yaml:"isActive,omitempty" required:"false"`
Roles []string `json:"roles,omitempty" yaml:"roles,omitempty" required:"true" uniqueItems:"true"`
Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"`
}
type IssuerInput ¶
type IssuerInput struct {
Issuer string `query:"issuer,omitempty" required:"true"`
}
type OTP ¶
type OTP struct {
Body struct {
Password string `json:"password,omitempty" required:"true" minLength:"6" maxLength:"6" pattern:"[0-9]+"`
}
}
type RefreshToken ¶
type RefreshToken struct {
Body struct {
RefreshToken string `json:"refreshToken,omitempty" required:"true"`
}
}
type UpdateAdminBody ¶
type UpdateAdminBody struct {
Avatar *string `json:"avatar,omitempty" yaml:"avatar,omitempty" required:"false"`
Email *string `json:"email,omitempty" yaml:"email,omitempty" required:"false" format:"email" maxLength:"254"`
Username *string `json:"username,omitempty" yaml:"username,omitempty" required:"false" minLength:"3" maxLength:"100"`
Password *string `json:"password,omitempty" yaml:"password,omitempty" required:"false" minLength:"8" maxLength:"64"`
Metadata *map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"`
}
Click to show internal directories.
Click to hide internal directories.