Skip to content

Commit

Permalink
fix: group list query
Browse files Browse the repository at this point in the history
  • Loading branch information
soulsam480 committed Nov 3, 2024
1 parent 7d27aa1 commit ef83fd7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/app/controllers/groups.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fn handle_create_group(req: wisp.Request, ctx: config.Context) -> wisp.Response

case group.insert_group(create_group_params, ctx.db) {
Ok(group) -> wisp.ok() |> wisp.json_body(group_serializer.run(group))

Error(_) ->
wisp.internal_server_error()
|> wisp.json_body(base_serializer.serialize_error(
Expand All @@ -54,6 +55,7 @@ fn fetch_group_id(
) -> wisp.Response {
case int.parse(group_id) {
Ok(id) -> handle(id)

Error(_) ->
wisp.bad_request()
|> wisp.json_body(base_serializer.serialize_error(
Expand Down
2 changes: 1 addition & 1 deletion src/app/db/models/group.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn select_group_query_init() {
|> select.from_table("groups")
|> select.selects([
select.col("groups.id"),
select.col("griups.name"),
select.col("groups.name"),
select.col("groups.owner_id"),
select.col("groups.created_at"),
select.col("groups.deleted_at"),
Expand Down
2 changes: 1 addition & 1 deletion src/app/lib/response_helpers.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import wisp

/// wisp response with status code 401
pub fn unauthorized() -> wisp.Response {
response.Response(422, [], wisp.Empty)
response.Response(401, [], wisp.Empty)
}

0 comments on commit ef83fd7

Please sign in to comment.