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

PUT /articles/{slug} #162

Open nomisRev opened 1 year ago

nomisRev commented 1 year ago

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

      tags:
        - Articles
      summary: Update an article
      description: Update an article. Auth is required
      operationId: UpdateArticle
      parameters:
        - name: slug
          in: path
          description: Slug of the article to update
          required: true
          schema:
            type: string
      requestBody:
        $ref: '#/components/requestBodies/UpdateArticleRequest'
      responses:
        '200':
          $ref: '#/components/responses/SingleArticleResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/GenericError'
      security:
        - Token: []
      x-codegen-request-body-name: article
  1. Add missing domain objects UpdateArticleRequest and SingleArticleResponse if it doesn't exist.
  2. Implement updateArticleForSlug in ArticlePersistence by adding the corresponding SQL to SqlDelight
  3. Create articles.kt in routes if does not exist, implement the put route using ArticlePersistence
  4. 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!