User Post

'/users/{id}/posts'

GET

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

Auth: No

Get a user's posts.

POST

async create(
    @param.path.string('id') id: typeof User.prototype.id,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Post, {
            title: 'NewPostInUser',
            exclude: ['id'],
            optional: ['userId']
          }),
        },
      },
    }) post: Omit<Post, 'id'>,
  ): Promise<Post>

Auth: Yes RBAC: Admin, User (owner)

Create a post for a given user.

'/users/{id}/posts/{postId}'

PATCH

async patch(
    @param.path.string('id') id: string,
    @param.path.number('postId') postId: typeof Post.prototype.id,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Post, {partial: true}),
        },
      },
    })
    post: Partial<Post>
  ): Promise<Count>

Auth: Yes RBAC: Admin, User (owner)

Edit a post for a given user.

DEL

async delete(
    @param.path.string('id') id: typeof User.prototype.id,
    @param.path.number('postId') postId: typeof Post.prototype.id,
  ): Promise<Count>

Auth: Yes RBAC: Admin, User (owner)

Delete a post for a given user.

Last updated