Comment

Endpoints for managing comments on posts and projects.

'/comments/{type}/{id}'

GET

async find(
    @param.path.string('type') type: string,
    @param.path.number('id') id: number,
    @param.query.object('filter') filter?: Filter<Comment>,
  ): Promise<Comment[]>

Auth: No

Get comments for a given post or project.

POST

async create(
    @param.path.string('type') type: string,
    @param.path.number('id') id: typeof Post.prototype.id,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Comment, {
            title: 'NewPostCommentInPost',
            exclude: ['id'],
            optional: ['parentId', 'parentType'],
          }),
        },
      },
    })
    comment: Omit<Comment, 'id'>,
  ): Promise<Comment>

Auth: Yes

Create a comment under a given post or project. This makes use of the AuthorInterceptor which tags the request to this endpoint with metadata about the user making the request to set the author.

'/commentCount/{type}/{id}'

GET

async commentCount(
    @param.path.string('type') type: string,
    @param.path.number('id') id: number
  ): Promise<Count>

Auth: No

Gets the number of comments under a given post or project by ID.

'/comments/{commentId}'

PATCH

async patch(
    @param.path.number('commentId') commentId: number,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Comment, {
            title: 'Edited post comment',
            exclude: ['id'],
          }),
        },
      },
    })
    comment: Omit<Comment, 'id'>,
  ): Promise<Comment>

Auth: Yes RBAC: Admin, User (owner)

Updates/edits a given comment by ID.

DEL

async delete(
    @param.path.number('commentId') commentId: number,
  ): Promise<{"success": boolean}>

Auth: Yes RBAC: Admin, User (owner)

Deletes a given comment by ID.

Last updated