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

:construction_worker: add `lint` CI script

+60 -29
+18
.tangled/workflows/lint.yml
··· 1 + when: 2 + - event: ["push", "manual"] 3 + branch: ["main", "develop"] 4 + 5 + engine: nixery 6 + 7 + dependencies: 8 + nixpkgs: 9 + - gleam 10 + - beamminimal28packages.erlang 11 + - beamminimal28packages.rebar3 12 + 13 + steps: 14 + - name: check for syntax errors 15 + command: gleam check 16 + 17 + - name: check for unformatted files 18 + command: gleam format --check src test
-1
src/app.gleam
··· 70 70 // Start all essential processes under a supervision tree 71 71 let assert Ok(_) = 72 72 supervision_tree.start( 73 - ctx:, 74 73 pog_config:, 75 74 wisp_handler:, 76 75 ws_handler:,
+8 -6
src/app/domain/brigade/sql.gleam
··· 41 41 " 42 42 |> pog.query 43 43 |> pog.parameter(pog.text(uuid.to_string(arg_1))) 44 - |> pog.parameter( 45 - pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2), 46 - ) 44 + |> pog.parameter(pog.array( 45 + fn(value) { pog.text(uuid.to_string(value)) }, 46 + arg_2, 47 + )) 47 48 |> pog.returning(decoder) 48 49 |> pog.execute(db) 49 50 } ··· 353 354 " 354 355 |> pog.query 355 356 |> pog.parameter(pog.text(uuid.to_string(arg_1))) 356 - |> pog.parameter( 357 - pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2), 358 - ) 357 + |> pog.parameter(pog.array( 358 + fn(value) { pog.text(uuid.to_string(value)) }, 359 + arg_2, 360 + )) 359 361 |> pog.returning(decoder) 360 362 |> pog.execute(db) 361 363 }
+12 -4
src/app/domain/data_analysis/sql.gleam
··· 131 131 "medic_emergency" -> decode.success(MedicEmergency) 132 132 _ -> decode.failure(Other, "OccurrenceCategoryEnum") 133 133 } 134 - }/// Corresponds to the Postgres `occurrence_priority_enum` enum. 134 + } 135 + 136 + /// Corresponds to the Postgres `occurrence_priority_enum` enum. 135 137 /// 136 138 /// > 🐿️ This type definition was generated automatically using v4.6.0 of the 137 139 /// > [squirrel package](https://github.com/giacomocavalieri/squirrel). ··· 150 152 "low" -> decode.success(Low) 151 153 _ -> decode.failure(High, "OccurrencePriorityEnum") 152 154 } 153 - }/// Corresponds to the Postgres `occurrence_subcategory_enum` enum. 155 + } 156 + 157 + /// Corresponds to the Postgres `occurrence_subcategory_enum` enum. 154 158 /// 155 159 /// > 🐿️ This type definition was generated automatically using v4.6.0 of the 156 160 /// > [squirrel package](https://github.com/giacomocavalieri/squirrel). ··· 174 178 HeartStop 175 179 } 176 180 177 - fn occurrence_subcategory_enum_decoder() -> decode.Decoder(OccurrenceSubcategoryEnum) { 181 + fn occurrence_subcategory_enum_decoder() -> decode.Decoder( 182 + OccurrenceSubcategoryEnum, 183 + ) { 178 184 use occurrence_subcategory_enum <- decode.then(decode.string) 179 185 case occurrence_subcategory_enum { 180 186 "injured_animal" -> decode.success(InjuredAnimal) ··· 195 201 "heart_stop" -> decode.success(HeartStop) 196 202 _ -> decode.failure(InjuredAnimal, "OccurrenceSubcategoryEnum") 197 203 } 198 - }/// Corresponds to the Postgres `user_role_enum` enum. 204 + } 205 + 206 + /// Corresponds to the Postgres `user_role_enum` enum. 199 207 /// 200 208 /// > 🐿️ This type definition was generated automatically using v4.6.0 of the 201 209 /// > [squirrel package](https://github.com/giacomocavalieri/squirrel).
+18 -12
src/app/domain/occurrence/sql.gleam
··· 41 41 " 42 42 |> pog.query 43 43 |> pog.parameter(pog.text(uuid.to_string(arg_1))) 44 - |> pog.parameter( 45 - pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2), 46 - ) 44 + |> pog.parameter(pog.array( 45 + fn(value) { pog.text(uuid.to_string(value)) }, 46 + arg_2, 47 + )) 47 48 |> pog.returning(decoder) 48 49 |> pog.execute(db) 49 50 } ··· 464 465 " 465 466 |> pog.query 466 467 |> pog.parameter(pog.text(uuid.to_string(arg_1))) 467 - |> pog.parameter( 468 - pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2), 469 - ) 468 + |> pog.parameter(pog.array( 469 + fn(value) { pog.text(uuid.to_string(value)) }, 470 + arg_2, 471 + )) 470 472 |> pog.returning(decoder) 471 473 |> pog.execute(db) 472 474 } ··· 551 553 MedicEmergency -> "medic_emergency" 552 554 } 553 555 |> pog.text 554 - }/// Corresponds to the Postgres `occurrence_priority_enum` enum. 556 + } 557 + 558 + /// Corresponds to the Postgres `occurrence_priority_enum` enum. 555 559 /// 556 560 /// > 🐿️ This type definition was generated automatically using v4.6.0 of the 557 561 /// > [squirrel package](https://github.com/giacomocavalieri/squirrel). ··· 579 583 Low -> "low" 580 584 } 581 585 |> pog.text 582 - }/// Corresponds to the Postgres `occurrence_subcategory_enum` enum. 586 + } 587 + 588 + /// Corresponds to the Postgres `occurrence_subcategory_enum` enum. 583 589 /// 584 590 /// > 🐿️ This type definition was generated automatically using v4.6.0 of the 585 591 /// > [squirrel package](https://github.com/giacomocavalieri/squirrel). ··· 603 609 HeartStop 604 610 } 605 611 606 - fn occurrence_subcategory_enum_decoder() -> decode.Decoder(OccurrenceSubcategoryEnum) { 612 + fn occurrence_subcategory_enum_decoder() -> decode.Decoder( 613 + OccurrenceSubcategoryEnum, 614 + ) { 607 615 use occurrence_subcategory_enum <- decode.then(decode.string) 608 616 case occurrence_subcategory_enum { 609 617 "injured_animal" -> decode.success(InjuredAnimal) ··· 626 634 } 627 635 } 628 636 629 - fn occurrence_subcategory_enum_encoder( 630 - occurrence_subcategory_enum, 631 - ) -> pog.Value { 637 + fn occurrence_subcategory_enum_encoder(occurrence_subcategory_enum) -> pog.Value { 632 638 case occurrence_subcategory_enum { 633 639 InjuredAnimal -> "injured_animal" 634 640 Flood -> "flood"
-2
src/app/supervision_tree.gleam
··· 1 - import app/web/context 2 1 import gleam/erlang/process 3 2 import gleam/http/request 4 3 import gleam/http/response ··· 18 17 19 18 /// 󰪋 Start the application supervisor 20 19 pub fn start( 21 - ctx ctx: context.Context, 22 20 pog_config pog_config: pog.Config, 23 21 wisp_handler wisp_handler: fn(wisp.Request) -> wisp.Response, 24 22 ws_handler ws_handler: fn(Request) -> Response,
+1 -1
test/admin_test.gleam
··· 1 - import app/http_router 2 1 import app/domain/role 3 2 import app/domain/user/sql as u_sql 3 + import app/http_router 4 4 import app_dev/sql as dev_sql 5 5 import app_test 6 6 import dummy
+1 -1
test/brigade_test.gleam
··· 1 - import app/http_router 2 1 import app/domain/role 2 + import app/http_router 3 3 import app_dev/sql as dev_sql 4 4 import app_test 5 5 import dummy
+1 -1
test/role_test.gleam
··· 1 - import app/http_router 2 1 import app/domain/role 2 + import app/http_router 3 3 import app_test 4 4 import gleam/dynamic/decode 5 5 import gleam/http
+1 -1
test/user_test.gleam
··· 1 - import app/http_router 2 1 import app/domain/role 3 2 import app/domain/user 3 + import app/http_router 4 4 import app_dev/sql as dev_sql 5 5 import app_test 6 6 import dummy