This commit is contained in:
ivamp 2024-12-10 18:27:29 +08:00
parent ce9bd1ccfe
commit 1ce37a91ce
7 changed files with 182 additions and 173 deletions

View File

@ -58,14 +58,14 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档块不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -98,7 +98,7 @@ const docTemplate = `{
"404": {
"description": "文档块不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -144,14 +144,14 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档块不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -193,14 +193,14 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -247,13 +247,13 @@ const docTemplate = `{
"403": {
"description": "无权访问",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "集合不存在或父文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -291,7 +291,7 @@ const docTemplate = `{
"404": {
"description": "集合不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -338,14 +338,14 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "集合不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -375,13 +375,13 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "集合不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -423,20 +423,20 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"403": {
"description": "无权访问",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "集合不存在或父文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -477,7 +477,7 @@ const docTemplate = `{
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -524,14 +524,14 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -569,13 +569,13 @@ const docTemplate = `{
"403": {
"description": "无权访问",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -622,14 +622,14 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -662,7 +662,7 @@ const docTemplate = `{
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -728,7 +728,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
}
@ -767,7 +767,7 @@ const docTemplate = `{
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -800,7 +800,7 @@ const docTemplate = `{
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -832,13 +832,16 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/entity.Workspace"
"type": "array",
"items": {
"$ref": "#/definitions/entity.WorkspaceMember"
}
}
},
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -885,20 +888,20 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"409": {
"description": "成员已存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -937,13 +940,13 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "工作空间不存在或成员不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -984,7 +987,7 @@ const docTemplate = `{
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -1100,9 +1103,6 @@ const docTemplate = `{
}
}
},
"dto.Response": {
"type": "object"
},
"dto.UpdateBlockRequest": {
"type": "object",
"required": [
@ -1130,14 +1130,6 @@ const docTemplate = `{
}
}
},
"dto.ValidateError": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"entity.Document": {
"type": "object",
"properties": {
@ -1292,6 +1284,17 @@ const docTemplate = `{
}
}
},
"response.Response": {
"type": "object"
},
"response.ValidateError": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"user.ID": {
"type": "string",
"enum": [

View File

@ -49,14 +49,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档块不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -89,7 +89,7 @@
"404": {
"description": "文档块不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -135,14 +135,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档块不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -184,14 +184,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -238,13 +238,13 @@
"403": {
"description": "无权访问",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "集合不存在或父文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -282,7 +282,7 @@
"404": {
"description": "集合不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -329,14 +329,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "集合不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -366,13 +366,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "集合不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -414,20 +414,20 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"403": {
"description": "无权访问",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "集合不存在或父文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -468,7 +468,7 @@
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -515,14 +515,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -560,13 +560,13 @@
"403": {
"description": "无权访问",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -613,14 +613,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -653,7 +653,7 @@
"404": {
"description": "文档不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -719,7 +719,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
}
@ -758,7 +758,7 @@
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -791,7 +791,7 @@
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -823,13 +823,16 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/entity.Workspace"
"type": "array",
"items": {
"$ref": "#/definitions/entity.WorkspaceMember"
}
}
},
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -876,20 +879,20 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ValidateError"
"$ref": "#/definitions/response.ValidateError"
}
}
},
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"409": {
"description": "成员已存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -928,13 +931,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "工作空间不存在或成员不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -975,7 +978,7 @@
"404": {
"description": "工作空间不存在",
"schema": {
"$ref": "#/definitions/dto.Response"
"$ref": "#/definitions/response.Response"
}
}
}
@ -1091,9 +1094,6 @@
}
}
},
"dto.Response": {
"type": "object"
},
"dto.UpdateBlockRequest": {
"type": "object",
"required": [
@ -1121,14 +1121,6 @@
}
}
},
"dto.ValidateError": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"entity.Document": {
"type": "object",
"properties": {
@ -1283,6 +1275,17 @@
}
}
},
"response.Response": {
"type": "object"
},
"response.ValidateError": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"user.ID": {
"type": "string",
"enum": [

View File

@ -69,8 +69,6 @@ definitions:
after_block_id:
type: integer
type: object
dto.Response:
type: object
dto.UpdateBlockRequest:
properties:
content:
@ -88,11 +86,6 @@ definitions:
name:
type: string
type: object
dto.ValidateError:
properties:
message:
type: string
type: object
entity.Document:
properties:
collection:
@ -194,6 +187,13 @@ definitions:
workspace_id:
type: integer
type: object
response.Response:
type: object
response.ValidateError:
properties:
message:
type: string
type: object
user.ID:
enum:
- anonymous
@ -224,7 +224,7 @@ paths:
"404":
description: 文档块不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 删除文档块
tags:
- Document
@ -255,12 +255,12 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 文档块不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 更新文档块
tags:
- Document
@ -290,12 +290,12 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 文档块不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 移动文档块
tags:
- Document
@ -322,12 +322,12 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 工作空间不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 创建集合
tags:
- Collection
@ -358,11 +358,11 @@ paths:
"403":
description: 无权访问
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
"404":
description: 集合不存在或父文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 列出文档树
tags:
- Document
@ -383,11 +383,11 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
"404":
description: 集合不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 删除集合
tags:
- Collection
@ -411,7 +411,7 @@ paths:
"404":
description: 集合不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 获取集合
tags:
- Collection
@ -442,12 +442,12 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 集合不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 更新集合
tags:
- Collection
@ -474,16 +474,16 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"403":
description: 无权访问
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
"404":
description: 集合不存在或父文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 创建文档
tags:
- Document
@ -510,7 +510,7 @@ paths:
"404":
description: 文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 列出文档块列表
tags:
- Document
@ -541,12 +541,12 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 创建文档块
tags:
- Document
@ -569,7 +569,7 @@ paths:
"404":
description: 文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 删除文档
tags:
- Document
@ -593,11 +593,11 @@ paths:
"403":
description: 无权访问
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
"404":
description: 文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 获取文档
tags:
- Document
@ -628,12 +628,12 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 文档不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 更新文档
tags:
- Document
@ -676,7 +676,7 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
summary: 创建工作空间
tags:
@ -700,7 +700,7 @@ paths:
"404":
description: 工作空间不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 删除工作空间
tags:
- Workspace
@ -724,7 +724,7 @@ paths:
"404":
description: 工作空间不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 获取工作空间
tags:
- Workspace
@ -745,11 +745,13 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/entity.Workspace'
items:
$ref: '#/definitions/entity.WorkspaceMember'
type: array
"404":
description: 工作空间不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 获取工作空间的成员
tags:
- Workspace
@ -780,16 +782,16 @@ paths:
description: 参数验证失败
schema:
items:
$ref: '#/definitions/dto.ValidateError'
$ref: '#/definitions/response.ValidateError'
type: array
"404":
description: 工作空间不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
"409":
description: 成员已存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 添加工作空间成员
tags:
- Workspace
@ -815,11 +817,11 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
"404":
description: 工作空间不存在或成员不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 移除工作空间成员
tags:
- Workspace
@ -846,7 +848,7 @@ paths:
"404":
description: 工作空间不存在
schema:
$ref: '#/definitions/dto.Response'
$ref: '#/definitions/response.Response'
summary: 列出集合列表
tags:
- Collection

View File

@ -40,8 +40,8 @@ func NewCollectionController(
// @Produce json
// @Param request body dto.CreateCollectionRequest true "创建集合请求"
// @Success 200 {object} entity.Collection
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "工作空间不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "工作空间不存在"
// @Router /collections [post]
func (c *CollectionController) CreateCollection(ctx *fiber.Ctx) error {
var req dto.CreateCollectionRequest
@ -81,7 +81,7 @@ func (c *CollectionController) CreateCollection(ctx *fiber.Ctx) error {
// @Produce json
// @Param id path int true "集合ID"
// @Success 200 {object} entity.Collection
// @Failure 404 {object} dto.Response "集合不存在"
// @Failure 404 {object} response.Response "集合不存在"
// @Router /collections/{id} [get]
func (c *CollectionController) GetCollection(ctx *fiber.Ctx) error {
var req dto.GetCollectionRequest
@ -113,7 +113,7 @@ func (c *CollectionController) GetCollection(ctx *fiber.Ctx) error {
// @Produce json
// @Param workspace_id path int true "工作空间ID"
// @Success 200 {object} []entity.Collection
// @Failure 404 {object} dto.Response "工作空间不存在"
// @Failure 404 {object} response.Response "工作空间不存在"
// @Router /workspaces/{workspace_id}/collections [get]
func (c *CollectionController) ListCollections(ctx *fiber.Ctx) error {
var req dto.ListCollectionsRequest
@ -147,8 +147,8 @@ func (c *CollectionController) ListCollections(ctx *fiber.Ctx) error {
// @Param id path int true "集合ID"
// @Param request body dto.UpdateCollectionRequest true "更新集合请求"
// @Success 200 {object} entity.Collection
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "集合不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "集合不存在"
// @Router /collections/{id} [put]
func (c *CollectionController) UpdateCollection(ctx *fiber.Ctx) error {
var params dto.CollectionIDParam
@ -208,8 +208,8 @@ func (c *CollectionController) UpdateCollection(ctx *fiber.Ctx) error {
// @Accept json
// @Produce json
// @Param id path int true "集合ID"
// @Success 200 {object} dto.Response
// @Failure 404 {object} dto.Response "集合不存在"
// @Success 200 {object} response.Response
// @Failure 404 {object} response.Response "集合不存在"
// @Router /collections/{id} [delete]
func (c *CollectionController) DeleteCollection(ctx *fiber.Ctx) error {
var params dto.CollectionIDParam

View File

@ -42,9 +42,9 @@ func NewDocumentController(
// @Produce json
// @Param request body dto.CreateDocumentRequest true "创建文档请求"
// @Success 200 {object} dto.DocumentDTO
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 403 {object} dto.Response "无权访问"
// @Failure 404 {object} dto.Response "集合不存在或父文档不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 403 {object} response.Response "无权访问"
// @Failure 404 {object} response.Response "集合不存在或父文档不存在"
// @Router /documents [post]
func (c *DocumentController) CreateDocument(ctx *fiber.Ctx) error {
var req dto.CreateDocumentRequest
@ -121,8 +121,8 @@ func (c *DocumentController) CreateDocument(ctx *fiber.Ctx) error {
// @Produce json
// @Param id path int true "文档ID"
// @Success 200 {object} dto.DocumentDTO
// @Failure 403 {object} dto.Response "无权访问"
// @Failure 404 {object} dto.Response "文档不存在"
// @Failure 403 {object} response.Response "无权访问"
// @Failure 404 {object} response.Response "文档不存在"
// @Router /documents/{id} [get]
func (c *DocumentController) GetDocument(ctx *fiber.Ctx) error {
var params dto.DocumentIDParam
@ -174,8 +174,8 @@ func (c *DocumentController) GetDocument(ctx *fiber.Ctx) error {
// @Param collection_id path int true "集合ID"
// @Param parent_id query int false "父文档ID不传则获取根文档"
// @Success 200 {object} []dto.DocumentDTO
// @Failure 403 {object} dto.Response "无权访问"
// @Failure 404 {object} dto.Response "集合不存在或父文档不存在"
// @Failure 403 {object} response.Response "无权访问"
// @Failure 404 {object} response.Response "集合不存在或父文档不存在"
// @Router /collections/{collection_id}/documents [get]
func (c *DocumentController) ListDocuments(ctx *fiber.Ctx) error {
var pathParams dto.ListDocumentsPathParam
@ -254,8 +254,8 @@ func (c *DocumentController) ListDocuments(ctx *fiber.Ctx) error {
// @Param id path int true "文档ID"
// @Param request body dto.UpdateDocumentRequest true "更新文档请求"
// @Success 200 {object} entity.Document
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "文档不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "文档不存在"
// @Router /documents/{id} [put]
func (c *DocumentController) UpdateDocument(ctx *fiber.Ctx) error {
var params dto.DocumentIDParam
@ -296,7 +296,7 @@ func (c *DocumentController) UpdateDocument(ctx *fiber.Ctx) error {
// @Produce json
// @Param id path int true "文档ID"
// @Success 200
// @Failure 404 {object} dto.Response "文档不存在"
// @Failure 404 {object} response.Response "文档不存在"
// @Router /documents/{id} [delete]
func (c *DocumentController) DeleteDocument(ctx *fiber.Ctx) error {
var params dto.DocumentIDParam
@ -321,8 +321,8 @@ func (c *DocumentController) DeleteDocument(ctx *fiber.Ctx) error {
// @Param document_id path int true "文档ID"
// @Param request body dto.CreateBlockRequest true "创建文档块请求"
// @Success 200 {object} entity.DocumentBlock
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "文档不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "文档不存在"
// @Router /documents/{document_id}/blocks [post]
func (c *DocumentController) CreateBlock(ctx *fiber.Ctx) error {
var params dto.ListBlocksRequest
@ -384,8 +384,8 @@ func (c *DocumentController) CreateBlock(ctx *fiber.Ctx) error {
// @Param block_id path int true "文档块ID"
// @Param request body dto.UpdateBlockRequest true "更新文档块请求"
// @Success 200 {object} entity.DocumentBlock
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "文档块不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "文档块不存在"
// @Router /blocks/{block_id} [put]
func (c *DocumentController) UpdateBlock(ctx *fiber.Ctx) error {
var params dto.BlockIDParam
@ -458,7 +458,7 @@ func (c *DocumentController) UpdateBlock(ctx *fiber.Ctx) error {
// @Produce json
// @Param block_id path int true "文档块ID"
// @Success 200
// @Failure 404 {object} dto.Response "文档块不存在"
// @Failure 404 {object} response.Response "文档块不存在"
// @Router /blocks/{block_id} [delete]
func (c *DocumentController) DeleteBlock(ctx *fiber.Ctx) error {
var params dto.BlockIDParam
@ -519,7 +519,7 @@ func (c *DocumentController) DeleteBlock(ctx *fiber.Ctx) error {
// @Produce json
// @Param document_id path int true "文档ID"
// @Success 200 {object} []entity.DocumentBlock
// @Failure 404 {object} dto.Response "文档不存在"
// @Failure 404 {object} response.Response "文档不存在"
// @Router /documents/{document_id}/blocks [get]
func (c *DocumentController) ListBlocks(ctx *fiber.Ctx) error {
var params dto.ListBlocksRequest
@ -572,8 +572,8 @@ func (c *DocumentController) ListBlocks(ctx *fiber.Ctx) error {
// @Param block_id path int true "文档块ID"
// @Param request body dto.MoveBlockRequest true "移动文档块请求"
// @Success 200
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "文档块不存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "文档块不存在"
// @Router /blocks/{block_id}/move [post]
func (c *DocumentController) MoveBlock(ctx *fiber.Ctx) error {
var params dto.BlockIDParam

View File

@ -35,7 +35,7 @@ func NewWorkspaceController(workspaceService *workspace.Service, authService *au
// @Produce json
// @Param request body dto.CreateWorkspaceRequest true "创建工作空间请求"
// @Success 200 {object} entity.Workspace
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Router /workspaces [post]
func (c *WorkspaceController) CreateWorkspace(ctx *fiber.Ctx) error {
var req dto.CreateWorkspaceRequest
@ -70,7 +70,7 @@ func (c *WorkspaceController) CreateWorkspace(ctx *fiber.Ctx) error {
// @Produce json
// @Param id path int true "工作空间ID"
// @Success 200 {object} entity.Workspace
// @Failure 404 {object} dto.Response "工作空间不存在"
// @Failure 404 {object} response.Response "工作空间不存在"
// @Router /workspaces/{id} [get]
func (c *WorkspaceController) GetWorkspace(ctx *fiber.Ctx) error {
var params dto.WorkspaceIDParam
@ -122,7 +122,7 @@ func (c *WorkspaceController) ListWorkspaces(ctx *fiber.Ctx) error {
// @Produce json
// @Param id path int true "工作空间ID"
// @Success 200
// @Failure 404 {object} dto.Response "工作空间不存在"
// @Failure 404 {object} response.Response "工作空间不存在"
// @Router /workspaces/{id} [delete]
func (c *WorkspaceController) DeleteWorkspace(ctx *fiber.Ctx) error {
var params dto.WorkspaceIDParam
@ -153,8 +153,8 @@ func (c *WorkspaceController) DeleteWorkspace(ctx *fiber.Ctx) error {
// @Accept json
// @Produce json
// @Param id path int true "工作空间ID"
// @Success 200 {object} entity.Workspace
// @Failure 404 {object} dto.Response "工作空间不存在"
// @Success 200 {object} []entity.WorkspaceMember
// @Failure 404 {object} response.Response "工作空间不存在"
// @Router /workspaces/{id}/members [get]
func (c *WorkspaceController) GetWorkspaceMembers(ctx *fiber.Ctx) error {
var params dto.WorkspaceIDParam
@ -192,9 +192,9 @@ func (c *WorkspaceController) GetWorkspaceMembers(ctx *fiber.Ctx) error {
// @Param id path int true "工作空间ID"
// @Param request body dto.AddWorkspaceMemberRequest true "添加成员请求"
// @Success 200 {object} entity.WorkspaceMember
// @Failure 400 {object} []dto.ValidateError "参数验证失败"
// @Failure 404 {object} dto.Response "工作空间不存在"
// @Failure 409 {object} dto.Response "成员已存在"
// @Failure 400 {object} []response.ValidateError "参数验证失败"
// @Failure 404 {object} response.Response "工作空间不存在"
// @Failure 409 {object} response.Response "成员已存在"
// @Router /workspaces/{id}/members [post]
func (c *WorkspaceController) AddMember(ctx *fiber.Ctx) error {
var params dto.WorkspaceIDParam
@ -246,8 +246,8 @@ func (c *WorkspaceController) AddMember(ctx *fiber.Ctx) error {
// @Produce json
// @Param id path int true "工作空间ID"
// @Param user_id path string true "用户ID"
// @Success 200 {object} dto.Response
// @Failure 404 {object} dto.Response "工作空间不存在或成员不存在"
// @Success 200 {object} response.Response
// @Failure 404 {object} response.Response "工作空间不存在或成员不存在"
// @Router /workspaces/{id}/members/{user_id} [delete]
func (c *WorkspaceController) RemoveMember(ctx *fiber.Ctx) error {
var params dto.WorkspaceMemberParam

View File

@ -35,6 +35,7 @@ func (a *Api) V1(r fiber.Router) {
workspaces.Delete("/:id", a.HttpHandler.Workspace.DeleteWorkspace)
// 工作空间成员管理
workspaces.Get("/:id/members", a.HttpHandler.Workspace.GetWorkspaceMembers)
workspaces.Post("/:id/members", a.HttpHandler.Workspace.AddMember)
workspaces.Delete("/:id/members/:user_id", a.HttpHandler.Workspace.RemoveMember)