diff --git a/api/v1/docs.go b/api/v1/docs.go index 8e193487..3f13a3b5 100644 --- a/api/v1/docs.go +++ b/api/v1/docs.go @@ -914,140 +914,6 @@ const docTemplate = `{ } } }, - "/api/v1/memo/{memoId}/resource": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "memo-resource" - ], - "summary": "Get resource list of a memo", - "parameters": [ - { - "type": "integer", - "description": "ID of memo to fetch resource list from", - "name": "memoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Memo resource list", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.Resource" - } - } - }, - "400": { - "description": "ID is not a number: %s" - }, - "500": { - "description": "Failed to fetch resource list" - } - } - }, - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "memo-resource" - ], - "summary": "Bind resource to memo", - "parameters": [ - { - "type": "integer", - "description": "ID of memo to bind resource to", - "name": "memoId", - "in": "path", - "required": true - }, - { - "description": "Memo resource request object", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.UpsertMemoResourceRequest" - } - } - ], - "responses": { - "200": { - "description": "Memo resource binded", - "schema": { - "type": "boolean" - } - }, - "400": { - "description": "ID is not a number: %s | Malformatted post memo resource request | Resource not found" - }, - "401": { - "description": "Missing user in session | Unauthorized to bind this resource" - }, - "500": { - "description": "Failed to fetch resource | Failed to upsert memo resource" - } - } - } - }, - "/api/v1/memo/{memoId}/resource/{resourceId}": { - "delete": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "memo-resource" - ], - "summary": "Unbind resource from memo", - "parameters": [ - { - "type": "integer", - "description": "ID of memo to unbind resource from", - "name": "memoId", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "ID of resource to unbind from memo", - "name": "resourceId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Memo resource unbinded. *200 is returned even if the reference doesn't exists ", - "schema": { - "type": "boolean" - } - }, - "400": { - "description": "Memo ID is not a number: %s | Resource ID is not a number: %s | Memo not found" - }, - "401": { - "description": "Missing user in session | Unauthorized" - }, - "500": { - "description": "Failed to find memo | Failed to fetch resource list" - } - } - } - }, "/api/v1/ping": { "get": { "produces": [ @@ -2359,7 +2225,7 @@ const docTemplate = `{ "internalPath": { "type": "string" }, - "linkedMemoAmount": { + "memoID": { "type": "integer" }, "size": { @@ -2745,41 +2611,6 @@ const docTemplate = `{ } } }, - "v1.Resource": { - "type": "object", - "properties": { - "createdTs": { - "type": "integer" - }, - "creatorId": { - "description": "Standard fields", - "type": "integer" - }, - "externalLink": { - "type": "string" - }, - "filename": { - "description": "Domain specific fields", - "type": "string" - }, - "id": { - "type": "integer" - }, - "linkedMemoAmount": { - "description": "Related fields", - "type": "integer" - }, - "size": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "updatedTs": { - "type": "integer" - } - } - }, "v1.Role": { "type": "string", "enum": [ @@ -3079,17 +2910,6 @@ const docTemplate = `{ } } }, - "v1.UpsertMemoResourceRequest": { - "type": "object", - "properties": { - "resourceId": { - "type": "integer" - }, - "updatedTs": { - "type": "integer" - } - } - }, "v1.UpsertSystemSettingRequest": { "type": "object", "properties": { diff --git a/api/v1/swagger.yaml b/api/v1/swagger.yaml index 52d89f43..75c9e225 100644 --- a/api/v1/swagger.yaml +++ b/api/v1/swagger.yaml @@ -147,7 +147,7 @@ definitions: type: integer internalPath: type: string - linkedMemoAmount: + memoID: type: integer size: type: integer @@ -404,30 +404,6 @@ definitions: visibility: $ref: '#/definitions/v1.Visibility' type: object - v1.Resource: - properties: - createdTs: - type: integer - creatorId: - description: Standard fields - type: integer - externalLink: - type: string - filename: - description: Domain specific fields - type: string - id: - type: integer - linkedMemoAmount: - description: Related fields - type: integer - size: - type: integer - type: - type: string - updatedTs: - type: integer - type: object v1.Role: enum: - HOST @@ -639,13 +615,6 @@ definitions: type: $ref: '#/definitions/v1.MemoRelationType' type: object - v1.UpsertMemoResourceRequest: - properties: - resourceId: - type: integer - updatedTs: - type: integer - type: object v1.UpsertSystemSettingRequest: properties: description: @@ -1299,97 +1268,6 @@ paths: summary: Delete a Memo Relation tags: - memo-relation - /api/v1/memo/{memoId}/resource: - get: - consumes: - - application/json - parameters: - - description: ID of memo to fetch resource list from - in: path - name: memoId - required: true - type: integer - produces: - - application/json - responses: - "200": - description: Memo resource list - schema: - items: - $ref: '#/definitions/v1.Resource' - type: array - "400": - description: 'ID is not a number: %s' - "500": - description: Failed to fetch resource list - summary: Get resource list of a memo - tags: - - memo-resource - post: - consumes: - - application/json - parameters: - - description: ID of memo to bind resource to - in: path - name: memoId - required: true - type: integer - - description: Memo resource request object - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.UpsertMemoResourceRequest' - produces: - - application/json - responses: - "200": - description: Memo resource binded - schema: - type: boolean - "400": - description: 'ID is not a number: %s | Malformatted post memo resource request - | Resource not found' - "401": - description: Missing user in session | Unauthorized to bind this resource - "500": - description: Failed to fetch resource | Failed to upsert memo resource - summary: Bind resource to memo - tags: - - memo-resource - /api/v1/memo/{memoId}/resource/{resourceId}: - delete: - consumes: - - application/json - parameters: - - description: ID of memo to unbind resource from - in: path - name: memoId - required: true - type: integer - - description: ID of resource to unbind from memo - in: path - name: resourceId - required: true - type: integer - produces: - - application/json - responses: - "200": - description: 'Memo resource unbinded. *200 is returned even if the reference - doesn''t exists ' - schema: - type: boolean - "400": - description: 'Memo ID is not a number: %s | Resource ID is not a number: - %s | Memo not found' - "401": - description: Missing user in session | Unauthorized - "500": - description: Failed to find memo | Failed to fetch resource list - summary: Unbind resource from memo - tags: - - memo-resource /api/v1/memo/all: get: description: |- diff --git a/docs/api/v1.md b/docs/api/v1.md index 6ae15d6e..e60f4cbc 100644 --- a/docs/api/v1.md +++ b/docs/api/v1.md @@ -476,72 +476,6 @@ Removes a relation between two memos | 400 | Memo ID is not a number: %s \| Related memo ID is not a number: %s | | | 500 | Failed to delete memo relation | | ---- -### /api/v1/memo/{memoId}/resource - -#### GET -##### Summary - -Get resource list of a memo - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ------ | -| memoId | path | ID of memo to fetch resource list from | Yes | integer | - -##### Responses - -| Code | Description | Schema | -| ---- | ----------- | ------ | -| 200 | Memo resource list | [ [v1.Resource](#v1resource) ] | -| 400 | ID is not a number: %s | | -| 500 | Failed to fetch resource list | | - -#### POST -##### Summary - -Bind resource to memo - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ------ | -| memoId | path | ID of memo to bind resource to | Yes | integer | -| body | body | Memo resource request object | Yes | [v1.UpsertMemoResourceRequest](#v1upsertmemoresourcerequest) | - -##### Responses - -| Code | Description | Schema | -| ---- | ----------- | ------ | -| 200 | Memo resource binded | boolean | -| 400 | ID is not a number: %s \| Malformatted post memo resource request \| Resource not found | | -| 401 | Missing user in session \| Unauthorized to bind this resource | | -| 500 | Failed to fetch resource \| Failed to upsert memo resource | | - -### /api/v1/memo/{memoId}/resource/{resourceId} - -#### DELETE -##### Summary - -Unbind resource from memo - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ------ | -| memoId | path | ID of memo to unbind resource from | Yes | integer | -| resourceId | path | ID of resource to unbind from memo | Yes | integer | - -##### Responses - -| Code | Description | Schema | -| ---- | ----------- | ------ | -| 200 | Memo resource unbinded. *200 is returned even if the reference doesn't exists | boolean | -| 400 | Memo ID is not a number: %s \| Resource ID is not a number: %s \| Memo not found | | -| 401 | Missing user in session \| Unauthorized | | -| 500 | Failed to find memo \| Failed to fetch resource list | | - --- ### /api/v1/ping @@ -1260,7 +1194,7 @@ Get website metadata | filename | string | Domain specific fields | No | | id | integer | | No | | internalPath | string | | No | -| linkedMemoAmount | integer | | No | +| memoID | integer | | No | | size | integer | | No | | type | string | | No | | updatedTs | integer | | No | @@ -1438,20 +1372,6 @@ Get website metadata | updatedTs | integer | | No | | visibility | [v1.Visibility](#v1visibility) | | No | -#### v1.Resource - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| createdTs | integer | | No | -| creatorId | integer | Standard fields | No | -| externalLink | string | | No | -| filename | string | Domain specific fields | No | -| id | integer | | No | -| linkedMemoAmount | integer | Related fields | No | -| size | integer | | No | -| type | string | | No | -| updatedTs | integer | | No | - #### v1.Role | Name | Type | Description | Required | @@ -1591,13 +1511,6 @@ Get website metadata | relatedMemoId | integer | | No | | type | [v1.MemoRelationType](#v1memorelationtype) | | No | -#### v1.UpsertMemoResourceRequest - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| resourceId | integer | | No | -| updatedTs | integer | | No | - #### v1.UpsertSystemSettingRequest | Name | Type | Description | Required |