wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam

:art: convert to funtion call

+15 -20
+15 -20
src/app/web/socket.gleam
··· 375 375 |> result.map_error(Database), 376 376 ) 377 377 378 - list.map(returned.rows, fn(row) { 379 - case row.notification_type { 380 - notif_sql.Emergency -> category.MedicEmergency 381 - notif_sql.Fire -> category.Fire 382 - notif_sql.Other -> category.Other 383 - notif_sql.Traffic -> category.TrafficAccident 384 - } 385 - }) 378 + use row <- list.map(returned.rows) 379 + case row.notification_type { 380 + notif_sql.Emergency -> category.MedicEmergency 381 + notif_sql.Fire -> category.Fire 382 + notif_sql.Other -> category.Other 383 + notif_sql.Traffic -> category.TrafficAccident 384 + } 386 385 } 387 386 388 387 // ON CLOSE -------------------------------------------------------------------- ··· 459 458 |> send_response(500) 460 459 461 460 pog.PostgresqlError(code:, name:, message:) -> 462 - [ 461 + json.object([ 463 462 #("code", json.string(code)), 464 463 #("name", json.string(name)), 465 464 #("message", json.string(message)), 466 - ] 467 - |> json.object 465 + ]) 468 466 |> json.to_string 469 467 |> send_response(500) 470 468 ··· 473 471 |> send_response(500) 474 472 475 473 pog.ConstraintViolated(message:, constraint:, detail:) -> 476 - [ 474 + json.object([ 477 475 #("message", json.string(message)), 478 476 #("constraint", json.string(constraint)), 479 477 #("detail", json.string(detail)), 480 - ] 481 - |> json.object 478 + ]) 482 479 |> json.to_string 483 480 |> send_response(409) 484 481 485 482 pog.UnexpectedArgumentCount(expected:, got:) -> { 486 - [ 483 + json.object([ 487 484 #("expected", json.int(expected)), 488 485 #("got", json.int(got)), 489 - ] 490 - |> json.object 486 + ]) 491 487 |> json.to_string 492 488 |> send_response(400) 493 489 } 494 490 495 491 pog.UnexpectedArgumentType(expected:, got:) -> { 496 - [ 492 + json.object([ 497 493 #("expected", json.string(expected)), 498 494 #("got", json.string(got)), 499 - ] 500 - |> json.object 495 + ]) 501 496 |> json.to_string 502 497 |> send_response(400) 503 498 }