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: lint and format code
kacaii.dev
2 months ago
fe41257b
17a8dce2
+45
-22
4 changed files
expand all
collapse all
unified
split
src
app
domain
brigade
sql.gleam
data_analysis
sql.gleam
occurrence
sql.gleam
taskfiles
GleamTasks.yml
+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
}
···
511
512
"
512
513
|> pog.query
513
514
|> pog.parameter(pog.text(uuid.to_string(arg_1)))
514
514
-
|> pog.parameter(
515
515
-
pog.array(fn(value) { pog.text(uuid.to_string(value)) }, arg_2),
516
516
-
)
515
515
+
|> pog.parameter(pog.array(
516
516
+
fn(value) { pog.text(uuid.to_string(value)) },
517
517
+
arg_2,
518
518
+
))
517
519
|> pog.returning(decoder)
518
520
|> pog.execute(db)
519
521
}
···
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"
+7
taskfiles/GleamTasks.yml
···
9
9
desc: Generate sql queries using Squirrel
10
10
aliases: [s]
11
11
cmd: gleam run -m squirrel
12
12
+
13
13
+
lint:
14
14
+
desc: Lint and Format code
15
15
+
cmds:
16
16
+
- gleam check
17
17
+
- gleam format
18
18
+
- gleam format --check src test