chore: initial commit
This commit is contained in:
11
internal/model/request/category.go
Normal file
11
internal/model/request/category.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
type CreateCategoryRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1"`
|
||||
Code string `json:"code" validate:"required,min=1"`
|
||||
}
|
||||
|
||||
type UpdateCategoryRequest struct {
|
||||
Name *string `json:"name" validate:"omitempty,min=1"`
|
||||
Code *string `json:"code" validate:"omitempty,min=1"`
|
||||
}
|
||||
30
internal/model/request/post.go
Normal file
30
internal/model/request/post.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type CreatePostRequest struct {
|
||||
Title string `json:"title" validate:"required,min=1"`
|
||||
CoverID *int32 `json:"cover_id" validate:"required,min=1"`
|
||||
Slug string `json:"slug" validate:"required,min=0"`
|
||||
Content string `json:"content" validate:"required,min=0"`
|
||||
Summary string `json:"summary" validate:"required,min=0"`
|
||||
Status *int16 `json:"status" validate:"required,oneof=0 1 2"`
|
||||
Sort *int32 `json:"sort" validate:"required,min=0"`
|
||||
PublishedAt time.Time `json:"published_at" validate:"required"`
|
||||
CategoryID *int32 `json:"category_id" validate:"required,min=1"`
|
||||
}
|
||||
|
||||
type UpdatePostRequest struct {
|
||||
Title *string `json:"title" validate:"omitempty,min=1"`
|
||||
CoverID *int32 `json:"cover_id" validate:"omitempty,min=1"`
|
||||
Slug *string `json:"slug" validate:"omitempty,min=1"`
|
||||
Content *string `json:"content" validate:"required,min=0"`
|
||||
Summary *string `json:"summary" validate:"omitempty,min=1"`
|
||||
Status *int16 `json:"status" validate:"omitempty,oneof=0 1 2"`
|
||||
View *int32 `json:"view" validate:"omitempty,min=1"`
|
||||
Sort *int32 `json:"sort" validate:"omitempty,min=0"`
|
||||
PublishedAt *time.Time `json:"published_at" validate:"omitempty"`
|
||||
CategoryID *int32 `json:"category_id" validate:"required,min=1"`
|
||||
}
|
||||
17
internal/model/request/sys_api.go
Normal file
17
internal/model/request/sys_api.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package request
|
||||
|
||||
type CreateSysApiRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=100"`
|
||||
GroupName string `json:"group_name" validate:"required,min=1,max=100"`
|
||||
Path string `json:"path" validate:"required,min=1,max=100"`
|
||||
Method string `json:"method" validate:"required,oneof=GET POST PUT PATCH DELETE"`
|
||||
Sort *int32 `json:"sort" validate:"required,min=0"`
|
||||
}
|
||||
|
||||
type UpdateSysApiRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=100"`
|
||||
GroupName string `json:"group_name" validate:"required,min=1,max=100"`
|
||||
Path string `json:"path" validate:"required,min=1,max=100"`
|
||||
Method string `json:"method" validate:"required,oneof=GET POST PUT PATCH DELETE"`
|
||||
Sort *int32 `json:"sort" validate:"required,min=0"`
|
||||
}
|
||||
31
internal/model/request/sys_menu.go
Normal file
31
internal/model/request/sys_menu.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"server/internal/pkg/validator"
|
||||
)
|
||||
|
||||
type CreateSysMenuRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=100"`
|
||||
Path string `json:"path" validate:"required,min=1,max=100"`
|
||||
Type *int16 `json:"type" validate:"required,oneof=0 1 2"`
|
||||
Component *string `json:"component" validate:"omitempty"`
|
||||
Hidden *bool `json:"hidden" validate:"omitempty"`
|
||||
Sort *int32 `json:"sort" validate:"required,min=0"`
|
||||
Status *int16 `json:"status" validate:"required,oneof=0 1"`
|
||||
ParentID *int32 `json:"parent_id" validate:"omitempty,gt=0"`
|
||||
Icon *int32 `json:"icon" validate:"omitempty"`
|
||||
PermissionCode string `json:"permission_code" validate:"required,min=1,max=100"`
|
||||
}
|
||||
|
||||
type UpdateSysMenuRequest struct {
|
||||
Name *string `json:"name" validate:"omitempty,min=1,max=100"`
|
||||
Path *string `json:"path" validate:"omitempty,min=1,max=100"`
|
||||
Type *int16 `json:"type" validate:"omitempty,oneof=0 1 2"`
|
||||
Component *string `json:"component" validate:"omitempty"`
|
||||
Hidden *bool `json:"hidden" validate:"omitempty"`
|
||||
Sort *int32 `json:"sort" validate:"omitempty,min=0"`
|
||||
Status *int16 `json:"status" validate:"omitempty,oneof=0 1"`
|
||||
ParentID validator.NullInt32 `json:"parent_id" validate:"omitempty"`
|
||||
Icon *int32 `json:"icon" validate:"omitempty"`
|
||||
PermissionCode *string `json:"permission_code" validate:"omitempty,min=1,max=100"`
|
||||
}
|
||||
1
internal/model/request/sys_permission.go
Normal file
1
internal/model/request/sys_permission.go
Normal file
@@ -0,0 +1 @@
|
||||
package request
|
||||
18
internal/model/request/sys_role.go
Normal file
18
internal/model/request/sys_role.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package request
|
||||
|
||||
type CreateSysRoleRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=100"`
|
||||
Code string `json:"code" validate:"required,max=100"`
|
||||
}
|
||||
|
||||
type UpdateSysRoleRequest struct {
|
||||
Name *string `json:"name" validate:"min=1,max=100"`
|
||||
}
|
||||
|
||||
type SetSysRoleMenusRequest struct {
|
||||
MenuIDs []int32 `json:"menu_ids" validate:"required,dive,gt=0"`
|
||||
}
|
||||
|
||||
type SetSysRoleApisRequest struct {
|
||||
ApiIDs []int32 `json:"api_ids" validate:"required,dive,gt=0"`
|
||||
}
|
||||
30
internal/model/request/sys_user.go
Normal file
30
internal/model/request/sys_user.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"server/internal/pkg/validator"
|
||||
)
|
||||
|
||||
type CreateSysUserRequest struct {
|
||||
Username string `json:"username" validate:"required"`
|
||||
Account string `json:"account" validate:"required,min=5,max=100"`
|
||||
Password string `json:"password" validate:"required,min=6,max=255"`
|
||||
AvatarID *int32 `json:"avatar_id" validate:"omitempty"`
|
||||
}
|
||||
|
||||
type UpdateSysUserRequest struct {
|
||||
Username *string `json:"username" validate:"omitempty,min=0,max=50"`
|
||||
AvatarID validator.NullInt32 `json:"avatar_id" validate:"omitempty"`
|
||||
}
|
||||
|
||||
type UpdateSysUserPassword struct {
|
||||
Password string `json:"password" validate:"required,min=6,max=255"`
|
||||
}
|
||||
|
||||
type SetSysUserRolesRequest struct {
|
||||
RoleIDs []int32 `json:"role_ids" validate:"required,dive,gt=0"`
|
||||
}
|
||||
|
||||
type LoginRequest struct {
|
||||
Account string `json:"account" validate:"required,min=5,max=100"`
|
||||
Password string `json:"password" validate:"required,min=6,max=255"`
|
||||
}
|
||||
Reference in New Issue
Block a user