Skip to content

Create resource should return the resource #193

Description

@GaballaGit

What sparked this issue was this comment in the recent PR #189 it goes like this:

// TODO: Get event and return it here. Issue is that the generated sqlc func
    // isn't returning the resource, so the service isn't either.

This should be a simple fix, from the sqlc docs we have an example:

-- name: CreateAuthor :one
INSERT INTO authors (
  name, bio
) VALUES (
  $1, $2
)
RETURNING *;

In our create queries we do not have the RETURNING clause at the end so it returns nothing.
Following this make sure sqlc updates the generated go code, and adjust the the api accordingly to make routes like /POST events return the new resource created.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2 - BEGINNERAn issue where no prerequisite knowledge is requiredapiRelating to the API only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions