nomisRev / ktor-arrow-example

Real World implementation - "The mother of all demo apps". Written in Kotlin, with Ktor, Arrow, SqlDelight, KotlinX Serialization, etc.
Apache License 2.0
271 stars 34 forks source link

POST /articles #160

Open nomisRev opened 1 year ago

nomisRev commented 1 year ago

In order to fully support articles we need to implement a POST article, according to following OpenAPI Spec.

/articles:
  post:
    tags:
      - Articles
    summary: Create an article
    description: Create an article. Auth is required
    operationId: CreateArticle
    requestBody:
      NewArticleRequest:
        required: true
        description: Article to create
        content:
          application/json:
            schema:
              required:
                - article
              type: object
              properties:
                article:
                  required:
                    - body
                    - description
                    - title
                  type: object
                  properties:
                    title:
                      type: string
                    description:
                      type: string
                    body:
                      type: string
                    tagList:
                      type: array
                      items:
                        type: string
    responses:
      '201':
        description: Single article
        content:
          application/json:
            schema:
              required:
                - article
              type: object
              properties:
                article:
                  $ref: '#/components/schemas/Article'
      '401':
        $ref: '#/components/responses/Unauthorized'
      '422':
        $ref: '#/components/responses/GenericError'
    security:
      - Token: []
    x-codegen-request-body-name: article  
  1. Add missing domain objects if it doesn't exist.
  2. Create articles.kt in routes if does not exist using ArticlePersistence.
  3. Add test that verifies the behavior works

Please assign yourself to this ticket before starting, and if you run into any issues please raise a PR so I can provide help and support directly in the code.

Thank you in advance for your interest in the project! Happy hacktoberfest!

arioston commented 1 year ago

can I work on this?

nomisRev commented 1 year ago

Of course you can @arioston 😁 I assigned you to the ticket 😉