tangled
alpha
login
or
join now
kacaii.dev
/
senac-brigade-server
0
fork
atom
wip: currently rewriting the project as a full stack application
tangled.org/kacaii.dev/sigo
gleam
0
fork
atom
overview
issues
1
pulls
pipelines
:art: convert to funtion call
kacaii.dev
3 months ago
90c4a1cb
f87f96e5
+15
-20
1 changed file
expand all
collapse all
unified
split
src
app
web
socket.gleam
+15
-20
src/app/web/socket.gleam
···
375
375
|> result.map_error(Database),
376
376
)
377
377
378
378
-
list.map(returned.rows, fn(row) {
379
379
-
case row.notification_type {
380
380
-
notif_sql.Emergency -> category.MedicEmergency
381
381
-
notif_sql.Fire -> category.Fire
382
382
-
notif_sql.Other -> category.Other
383
383
-
notif_sql.Traffic -> category.TrafficAccident
384
384
-
}
385
385
-
})
378
378
+
use row <- list.map(returned.rows)
379
379
+
case row.notification_type {
380
380
+
notif_sql.Emergency -> category.MedicEmergency
381
381
+
notif_sql.Fire -> category.Fire
382
382
+
notif_sql.Other -> category.Other
383
383
+
notif_sql.Traffic -> category.TrafficAccident
384
384
+
}
386
385
}
387
386
388
387
// ON CLOSE --------------------------------------------------------------------
···
459
458
|> send_response(500)
460
459
461
460
pog.PostgresqlError(code:, name:, message:) ->
462
462
-
[
461
461
+
json.object([
463
462
#("code", json.string(code)),
464
463
#("name", json.string(name)),
465
464
#("message", json.string(message)),
466
466
-
]
467
467
-
|> json.object
465
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
476
-
[
474
474
+
json.object([
477
475
#("message", json.string(message)),
478
476
#("constraint", json.string(constraint)),
479
477
#("detail", json.string(detail)),
480
480
-
]
481
481
-
|> json.object
478
478
+
])
482
479
|> json.to_string
483
480
|> send_response(409)
484
481
485
482
pog.UnexpectedArgumentCount(expected:, got:) -> {
486
486
-
[
483
483
+
json.object([
487
484
#("expected", json.int(expected)),
488
485
#("got", json.int(got)),
489
489
-
]
490
490
-
|> json.object
486
486
+
])
491
487
|> json.to_string
492
488
|> send_response(400)
493
489
}
494
490
495
491
pog.UnexpectedArgumentType(expected:, got:) -> {
496
496
-
[
492
492
+
json.object([
497
493
#("expected", json.string(expected)),
498
494
#("got", json.string(got)),
499
499
-
]
500
500
-
|> json.object
495
495
+
])
501
496
|> json.to_string
502
497
|> send_response(400)
503
498
}