Post

Endpoints for managing forum posts.

'/posts'

POST

async create(
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Post, {
            title: 'NewPost',
            exclude: ['id'],
          }),
        },
      },
    })
    post: Omit<Post, 'id'>,
  ): Promise<object>

Auth: Yes

Create a post for a user.

GET

async find(
    @param.filter(Post) filter?: Filter<Post>,
  ): Promise<Post[]>

Auth: Yes

Get all posts.

PATCH

async updateAll(
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Post, {partial: true}),
        },
      },
    })
    post: Post,
    @param.where(Post) where?: Where<Post>,
  ): Promise<Count>

Auth: Yes RBAC: Admin, User (owner)

Update all posts.

'/posts/count'

GET

async count(
    @param.where(Post) where?: Where<Post>,
  ): Promise<Count>

Auth: No

Get the number of posts.

'/posts/{id}'

GET

async findById(
    @param.path.number('id') id: number,
    @param.filter(Post, {exclude: 'where'}) filter?: FilterExcludingWhere<Post>
  ): Promise<Post>

Auth: No

Get a specific post by ID.

PATCH

async updateById(
    @param.path.number('id') id: number,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Post, {partial: true}),
        },
      },
    })
    post: Post,
  ): Promise<void>

Auth: Yes RBAC: Admin, User (owner)

Update a specific post by ID.

PUT

async replaceById(
    @param.path.number('id') id: number,
    @requestBody() post: Post,
  ): Promise<void>

Auth: Yes RBAC: Admin, User (owner)

Overwrite a specific post by ID.

DEL

async deleteById(@param.path.number('id') id: number): Promise<void>

Auth: Yes RBAC: Admin, User (owner)

Overwrite a specific post by ID.

GET

async getFeaturedPosts(): Promise<Post[]>

Auth: No

Get all featured posts.

Last updated