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
:construction_worker: add `lint` CI script
kacaii.dev
2 months ago
0102b905
94fc850e
+60
-29
10 changed files
expand all
collapse all
unified
split
.tangled
workflows
lint.yml
src
app
domain
brigade
sql.gleam
data_analysis
sql.gleam
occurrence
sql.gleam
supervision_tree.gleam
app.gleam
test
admin_test.gleam
brigade_test.gleam
role_test.gleam
user_test.gleam
+18
.tangled/workflows/lint.yml
···
1
1
+
when:
2
2
+
- event: ["push", "manual"]
3
3
+
branch: ["main", "develop"]
4
4
+
5
5
+
engine: nixery
6
6
+
7
7
+
dependencies:
8
8
+
nixpkgs:
9
9
+
- gleam
10
10
+
- beamminimal28packages.erlang
11
11
+
- beamminimal28packages.rebar3
12
12
+
13
13
+
steps:
14
14
+
- name: check for syntax errors
15
15
+
command: gleam check
16
16
+
17
17
+
- name: check for unformatted files
18
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
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
44
-
|> pog.parameter(
45
45
-
pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2),
46
46
-
)
44
44
+
|> pog.parameter(pog.array(
45
45
+
fn(value) { pog.text(uuid.to_string(value)) },
46
46
+
arg_2,
47
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
356
-
|> pog.parameter(
357
357
-
pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2),
358
358
-
)
357
357
+
|> pog.parameter(pog.array(
358
358
+
fn(value) { pog.text(uuid.to_string(value)) },
359
359
+
arg_2,
360
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
134
-
}/// Corresponds to the Postgres `occurrence_priority_enum` enum.
134
134
+
}
135
135
+
136
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
153
-
}/// Corresponds to the Postgres `occurrence_subcategory_enum` enum.
155
155
+
}
156
156
+
157
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
177
-
fn occurrence_subcategory_enum_decoder() -> decode.Decoder(OccurrenceSubcategoryEnum) {
181
181
+
fn occurrence_subcategory_enum_decoder() -> decode.Decoder(
182
182
+
OccurrenceSubcategoryEnum,
183
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
198
-
}/// Corresponds to the Postgres `user_role_enum` enum.
204
204
+
}
205
205
+
206
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
44
-
|> pog.parameter(
45
45
-
pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2),
46
46
-
)
44
44
+
|> pog.parameter(pog.array(
45
45
+
fn(value) { pog.text(uuid.to_string(value)) },
46
46
+
arg_2,
47
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
467
-
|> pog.parameter(
468
468
-
pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2),
469
469
-
)
468
468
+
|> pog.parameter(pog.array(
469
469
+
fn(value) { pog.text(uuid.to_string(value)) },
470
470
+
arg_2,
471
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
554
-
}/// Corresponds to the Postgres `occurrence_priority_enum` enum.
556
556
+
}
557
557
+
558
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
582
-
}/// Corresponds to the Postgres `occurrence_subcategory_enum` enum.
586
586
+
}
587
587
+
588
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
606
-
fn occurrence_subcategory_enum_decoder() -> decode.Decoder(OccurrenceSubcategoryEnum) {
612
612
+
fn occurrence_subcategory_enum_decoder() -> decode.Decoder(
613
613
+
OccurrenceSubcategoryEnum,
614
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
629
-
fn occurrence_subcategory_enum_encoder(
630
630
-
occurrence_subcategory_enum,
631
631
-
) -> pog.Value {
637
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
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
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
1
-
import app/http_router
2
1
import app/domain/role
3
2
import app/domain/user/sql as u_sql
3
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
1
-
import app/http_router
2
1
import app/domain/role
2
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
1
-
import app/http_router
2
1
import app/domain/role
2
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
1
-
import app/http_router
2
1
import app/domain/role
3
2
import app/domain/user
3
3
+
import app/http_router
4
4
import app_dev/sql as dev_sql
5
5
import app_test
6
6
import dummy