feat: update client approval
This commit is contained in:
parent
1c9b288e10
commit
d2f2158ae5
|
|
@ -2,84 +2,84 @@ package request
|
|||
|
||||
// CreateClientApprovalSettingsRequest represents request for creating client approval settings
|
||||
type CreateClientApprovalSettingsRequest struct {
|
||||
RequiresApproval bool `json:"requires_approval" validate:"required"`
|
||||
DefaultWorkflowId *uint `json:"default_workflow_id" validate:"omitempty,min=1"`
|
||||
AutoPublishArticles bool `json:"auto_publish_articles"`
|
||||
ApprovalExemptUsers []uint `json:"approval_exempt_users" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptRoles []uint `json:"approval_exempt_roles" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptCategories []uint `json:"approval_exempt_categories" validate:"omitempty,dive,min=1"`
|
||||
RequireApprovalFor []string `json:"require_approval_for" validate:"omitempty,dive,min=1"`
|
||||
SkipApprovalFor []string `json:"skip_approval_for" validate:"omitempty,dive,min=1"`
|
||||
IsActive bool `json:"is_active"`
|
||||
RequiresApproval bool `json:"requiresApproval"`
|
||||
DefaultWorkflowId *uint `json:"defaultWorkflowId" validate:"omitempty,min=1"`
|
||||
AutoPublishArticles bool `json:"autoPublishArticles"`
|
||||
ApprovalExemptUsers []uint `json:"approvalExemptUsers" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptRoles []uint `json:"approvalExemptRoles" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptCategories []uint `json:"approvalExemptCategories" validate:"omitempty,dive,min=1"`
|
||||
RequireApprovalFor []string `json:"requireApprovalFor" validate:"omitempty,dive,min=1"`
|
||||
SkipApprovalFor []string `json:"skipApprovalFor" validate:"omitempty,dive,min=1"`
|
||||
IsActive bool `json:"isActive"`
|
||||
}
|
||||
|
||||
// UpdateClientApprovalSettingsRequest represents request for updating client approval settings
|
||||
type UpdateClientApprovalSettingsRequest struct {
|
||||
RequiresApproval *bool `json:"requires_approval"`
|
||||
DefaultWorkflowId **uint `json:"default_workflow_id"` // double pointer to allow nil
|
||||
AutoPublishArticles *bool `json:"auto_publish_articles"`
|
||||
ApprovalExemptUsers []uint `json:"approval_exempt_users" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptRoles []uint `json:"approval_exempt_roles" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptCategories []uint `json:"approval_exempt_categories" validate:"omitempty,dive,min=1"`
|
||||
RequireApprovalFor []string `json:"require_approval_for" validate:"omitempty,dive,min=1"`
|
||||
SkipApprovalFor []string `json:"skip_approval_for" validate:"omitempty,dive,min=1"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
RequiresApproval *bool `json:"requiresApproval"`
|
||||
DefaultWorkflowId **uint `json:"defaultWorkflowId"` // double pointer to allow nil
|
||||
AutoPublishArticles *bool `json:"autoPublishArticles"`
|
||||
ApprovalExemptUsers []uint `json:"approvalExemptUsers" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptRoles []uint `json:"approvalExemptRoles" validate:"omitempty,dive,min=1"`
|
||||
ApprovalExemptCategories []uint `json:"approvalExemptCategories" validate:"omitempty,dive,min=1"`
|
||||
RequireApprovalFor []string `json:"requireApprovalFor" validate:"omitempty,dive,min=1"`
|
||||
SkipApprovalFor []string `json:"skipApprovalFor" validate:"omitempty,dive,min=1"`
|
||||
IsActive *bool `json:"isActive"`
|
||||
}
|
||||
|
||||
// ToggleApprovalRequest represents request for toggling approval requirement
|
||||
type ToggleApprovalRequest struct {
|
||||
RequiresApproval bool `json:"requires_approval" validate:"required"`
|
||||
RequiresApproval bool `json:"requiresApproval"`
|
||||
}
|
||||
|
||||
// EnableApprovalRequest represents request for enabling approval with smooth transition
|
||||
type EnableApprovalRequest struct {
|
||||
DefaultWorkflowId *uint `json:"default_workflow_id" validate:"omitempty,min=1"`
|
||||
DefaultWorkflowId *uint `json:"defaultWorkflowId" validate:"omitempty,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// DisableApprovalRequest represents request for disabling approval system
|
||||
type DisableApprovalRequest struct {
|
||||
Reason string `json:"reason" validate:"required,max=500"`
|
||||
HandleAction string `json:"handle_action" validate:"required,oneof=auto_approve keep_pending reset_to_draft"` // How to handle pending articles
|
||||
HandleAction string `json:"handleAction" validate:"required,oneof=auto_approve keep_pending reset_to_draft"` // How to handle pending articles
|
||||
}
|
||||
|
||||
// SetDefaultWorkflowRequest represents request for setting default workflow
|
||||
type SetDefaultWorkflowRequest struct {
|
||||
WorkflowId *uint `json:"workflow_id" validate:"omitempty,min=1"`
|
||||
WorkflowId *uint `json:"workflowId" validate:"omitempty,min=1"`
|
||||
}
|
||||
|
||||
// AddExemptUserRequest represents request for adding user to exemption
|
||||
type AddExemptUserRequest struct {
|
||||
UserId uint `json:"user_id" validate:"required,min=1"`
|
||||
UserId uint `json:"userId" validate:"required,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// RemoveExemptUserRequest represents request for removing user from exemption
|
||||
type RemoveExemptUserRequest struct {
|
||||
UserId uint `json:"user_id" validate:"required,min=1"`
|
||||
UserId uint `json:"userId" validate:"required,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// AddExemptRoleRequest represents request for adding role to exemption
|
||||
type AddExemptRoleRequest struct {
|
||||
RoleId uint `json:"role_id" validate:"required,min=1"`
|
||||
RoleId uint `json:"roleId" validate:"required,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// RemoveExemptRoleRequest represents request for removing role from exemption
|
||||
type RemoveExemptRoleRequest struct {
|
||||
RoleId uint `json:"role_id" validate:"required,min=1"`
|
||||
RoleId uint `json:"roleId" validate:"required,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// AddExemptCategoryRequest represents request for adding category to exemption
|
||||
type AddExemptCategoryRequest struct {
|
||||
CategoryId uint `json:"category_id" validate:"required,min=1"`
|
||||
CategoryId uint `json:"categoryId" validate:"required,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// RemoveExemptCategoryRequest represents request for removing category from exemption
|
||||
type RemoveExemptCategoryRequest struct {
|
||||
CategoryId uint `json:"category_id" validate:"required,min=1"`
|
||||
CategoryId uint `json:"categoryId" validate:"required,min=1"`
|
||||
Reason string `json:"reason" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7177,6 +7177,12 @@ const docTemplate = `{
|
|||
"description": "items per page",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "article type id",
|
||||
"name": "typeId",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -16847,48 +16853,45 @@ const docTemplate = `{
|
|||
},
|
||||
"request.CreateClientApprovalSettingsRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requires_approval"
|
||||
],
|
||||
"properties": {
|
||||
"approval_exempt_categories": {
|
||||
"approvalExemptCategories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_roles": {
|
||||
"approvalExemptRoles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_users": {
|
||||
"approvalExemptUsers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"auto_publish_articles": {
|
||||
"autoPublishArticles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"default_workflow_id": {
|
||||
"defaultWorkflowId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"is_active": {
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"require_approval_for": {
|
||||
"requireApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"requires_approval": {
|
||||
"requiresApproval": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"skip_approval_for": {
|
||||
"skipApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
@ -16950,11 +16953,11 @@ const docTemplate = `{
|
|||
"request.DisableApprovalRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"handle_action",
|
||||
"handleAction",
|
||||
"reason"
|
||||
],
|
||||
"properties": {
|
||||
"handle_action": {
|
||||
"handleAction": {
|
||||
"description": "How to handle pending articles",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
|
@ -16972,7 +16975,7 @@ const docTemplate = `{
|
|||
"request.EnableApprovalRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"default_workflow_id": {
|
||||
"defaultWorkflowId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
|
|
@ -17371,7 +17374,7 @@ const docTemplate = `{
|
|||
"request.SetDefaultWorkflowRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"workflow_id": {
|
||||
"workflowId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
|
|
@ -17405,11 +17408,8 @@ const docTemplate = `{
|
|||
},
|
||||
"request.ToggleApprovalRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requires_approval"
|
||||
],
|
||||
"properties": {
|
||||
"requires_approval": {
|
||||
"requiresApproval": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
|
|
@ -17452,44 +17452,44 @@ const docTemplate = `{
|
|||
"request.UpdateClientApprovalSettingsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approval_exempt_categories": {
|
||||
"approvalExemptCategories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_roles": {
|
||||
"approvalExemptRoles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_users": {
|
||||
"approvalExemptUsers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"auto_publish_articles": {
|
||||
"autoPublishArticles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"default_workflow_id": {
|
||||
"defaultWorkflowId": {
|
||||
"description": "double pointer to allow nil",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_active": {
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"require_approval_for": {
|
||||
"requireApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"requires_approval": {
|
||||
"requiresApproval": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"skip_approval_for": {
|
||||
"skipApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
|
|||
|
|
@ -7166,6 +7166,12 @@
|
|||
"description": "items per page",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "article type id",
|
||||
"name": "typeId",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -16836,48 +16842,45 @@
|
|||
},
|
||||
"request.CreateClientApprovalSettingsRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requires_approval"
|
||||
],
|
||||
"properties": {
|
||||
"approval_exempt_categories": {
|
||||
"approvalExemptCategories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_roles": {
|
||||
"approvalExemptRoles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_users": {
|
||||
"approvalExemptUsers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"auto_publish_articles": {
|
||||
"autoPublishArticles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"default_workflow_id": {
|
||||
"defaultWorkflowId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"is_active": {
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"require_approval_for": {
|
||||
"requireApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"requires_approval": {
|
||||
"requiresApproval": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"skip_approval_for": {
|
||||
"skipApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
@ -16939,11 +16942,11 @@
|
|||
"request.DisableApprovalRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"handle_action",
|
||||
"handleAction",
|
||||
"reason"
|
||||
],
|
||||
"properties": {
|
||||
"handle_action": {
|
||||
"handleAction": {
|
||||
"description": "How to handle pending articles",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
|
@ -16961,7 +16964,7 @@
|
|||
"request.EnableApprovalRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"default_workflow_id": {
|
||||
"defaultWorkflowId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
|
|
@ -17360,7 +17363,7 @@
|
|||
"request.SetDefaultWorkflowRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"workflow_id": {
|
||||
"workflowId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
|
|
@ -17394,11 +17397,8 @@
|
|||
},
|
||||
"request.ToggleApprovalRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requires_approval"
|
||||
],
|
||||
"properties": {
|
||||
"requires_approval": {
|
||||
"requiresApproval": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
|
|
@ -17441,44 +17441,44 @@
|
|||
"request.UpdateClientApprovalSettingsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approval_exempt_categories": {
|
||||
"approvalExemptCategories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_roles": {
|
||||
"approvalExemptRoles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"approval_exempt_users": {
|
||||
"approvalExemptUsers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"auto_publish_articles": {
|
||||
"autoPublishArticles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"default_workflow_id": {
|
||||
"defaultWorkflowId": {
|
||||
"description": "double pointer to allow nil",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_active": {
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"require_approval_for": {
|
||||
"requireApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"requires_approval": {
|
||||
"requiresApproval": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"skip_approval_for": {
|
||||
"skipApprovalFor": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
|
|||
|
|
@ -655,37 +655,35 @@ definitions:
|
|||
type: object
|
||||
request.CreateClientApprovalSettingsRequest:
|
||||
properties:
|
||||
approval_exempt_categories:
|
||||
approvalExemptCategories:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
approval_exempt_roles:
|
||||
approvalExemptRoles:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
approval_exempt_users:
|
||||
approvalExemptUsers:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
auto_publish_articles:
|
||||
autoPublishArticles:
|
||||
type: boolean
|
||||
default_workflow_id:
|
||||
defaultWorkflowId:
|
||||
minimum: 1
|
||||
type: integer
|
||||
is_active:
|
||||
isActive:
|
||||
type: boolean
|
||||
require_approval_for:
|
||||
requireApprovalFor:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
requires_approval:
|
||||
requiresApproval:
|
||||
type: boolean
|
||||
skip_approval_for:
|
||||
skipApprovalFor:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- requires_approval
|
||||
type: object
|
||||
request.CustomStaticPagesCreateRequest:
|
||||
properties:
|
||||
|
|
@ -724,7 +722,7 @@ definitions:
|
|||
type: object
|
||||
request.DisableApprovalRequest:
|
||||
properties:
|
||||
handle_action:
|
||||
handleAction:
|
||||
description: How to handle pending articles
|
||||
enum:
|
||||
- auto_approve
|
||||
|
|
@ -735,12 +733,12 @@ definitions:
|
|||
maxLength: 500
|
||||
type: string
|
||||
required:
|
||||
- handle_action
|
||||
- handleAction
|
||||
- reason
|
||||
type: object
|
||||
request.EnableApprovalRequest:
|
||||
properties:
|
||||
default_workflow_id:
|
||||
defaultWorkflowId:
|
||||
minimum: 1
|
||||
type: integer
|
||||
reason:
|
||||
|
|
@ -1013,7 +1011,7 @@ definitions:
|
|||
type: object
|
||||
request.SetDefaultWorkflowRequest:
|
||||
properties:
|
||||
workflow_id:
|
||||
workflowId:
|
||||
minimum: 1
|
||||
type: integer
|
||||
type: object
|
||||
|
|
@ -1036,10 +1034,8 @@ definitions:
|
|||
type: object
|
||||
request.ToggleApprovalRequest:
|
||||
properties:
|
||||
requires_approval:
|
||||
requiresApproval:
|
||||
type: boolean
|
||||
required:
|
||||
- requires_approval
|
||||
type: object
|
||||
request.UpdateApprovalWorkflowStepsRequest:
|
||||
properties:
|
||||
|
|
@ -1068,32 +1064,32 @@ definitions:
|
|||
type: object
|
||||
request.UpdateClientApprovalSettingsRequest:
|
||||
properties:
|
||||
approval_exempt_categories:
|
||||
approvalExemptCategories:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
approval_exempt_roles:
|
||||
approvalExemptRoles:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
approval_exempt_users:
|
||||
approvalExemptUsers:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
auto_publish_articles:
|
||||
autoPublishArticles:
|
||||
type: boolean
|
||||
default_workflow_id:
|
||||
defaultWorkflowId:
|
||||
description: double pointer to allow nil
|
||||
type: integer
|
||||
is_active:
|
||||
isActive:
|
||||
type: boolean
|
||||
require_approval_for:
|
||||
requireApprovalFor:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
requires_approval:
|
||||
requiresApproval:
|
||||
type: boolean
|
||||
skip_approval_for:
|
||||
skipApprovalFor:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
|
|
@ -6241,6 +6237,10 @@ paths:
|
|||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
- description: article type id
|
||||
in: query
|
||||
name: typeId
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
|
|||
Loading…
Reference in New Issue