@tricoteuses/senat 2.19.6 → 2.19.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/datasets.js CHANGED
@@ -31,24 +31,16 @@ export const datasets = {
31
31
  { name: "idx_senid", columns: ["senid"] },
32
32
  { name: "idx_grpid", columns: ["grpid"] },
33
33
  ],
34
- sen_ameli: [
35
- { name: "idx_entid", columns: ["entid"] },
36
- ],
37
- grppol_ameli: [
38
- { name: "idx_entid", columns: ["entid"] },
39
- ],
34
+ sen_ameli: [{ name: "idx_entid", columns: ["entid"] }],
35
+ grppol_ameli: [{ name: "idx_entid", columns: ["entid"] }],
40
36
  sub: [
41
37
  { name: "idx_id", columns: ["id"] },
42
38
  { name: "idx_typid", columns: ["typid"] },
43
39
  { name: "idx_merid", columns: ["merid"] },
44
40
  { name: "idx_comdelid", columns: ["comdelid"] },
45
41
  ],
46
- typsub: [
47
- { name: "idx_id", columns: ["id"] },
48
- ],
49
- typrect: [
50
- { name: "idx_id", columns: ["id"] },
51
- ],
42
+ typsub: [{ name: "idx_id", columns: ["id"] }],
43
+ typrect: [{ name: "idx_id", columns: ["id"] }],
52
44
  txt_ameli: [
53
45
  { name: "idx_id", columns: ["id"] },
54
46
  { name: "idx_txtetaid", columns: ["txtetaid"] },
@@ -56,44 +48,22 @@ export const datasets = {
56
48
  { name: "idx_natid", columns: ["natid"] },
57
49
  { name: "idx_lecid", columns: ["lecid"] },
58
50
  ],
59
- etatxt: [
60
- { name: "idx_id", columns: ["id"] },
61
- ],
51
+ etatxt: [{ name: "idx_id", columns: ["id"] }],
62
52
  ses: [
63
53
  { name: "idx_id", columns: ["id"] },
64
54
  { name: "idx_typid", columns: ["typid"] },
65
- { name: "idx_ann", columns: ["ann"] }
66
- ],
67
- typses: [
68
- { name: "idx_id", columns: ["id"] },
69
- ],
70
- nat: [
71
- { name: "idx_id", columns: ["id"] },
72
- ],
73
- lec_ameli: [
74
- { name: "idx_id", columns: ["id"] },
75
- ],
76
- mot: [
77
- { name: "idx_id", columns: ["id"] },
78
- ],
79
- avicom: [
80
- { name: "idx_id", columns: ["id"] },
81
- ],
82
- avigvt: [
83
- { name: "idx_id", columns: ["id"] },
84
- ],
85
- sor: [
86
- { name: "idx_id", columns: ["id"] },
87
- ],
88
- irr: [
89
- { name: "idx_id", columns: ["id"] },
90
- ],
91
- com_ameli: [
92
- { name: "idx_entid", columns: ["entid"] },
93
- ],
94
- cab: [
95
- { name: "idx_entid", columns: ["entid"] },
96
- ],
55
+ { name: "idx_ann", columns: ["ann"] },
56
+ ],
57
+ typses: [{ name: "idx_id", columns: ["id"] }],
58
+ nat: [{ name: "idx_id", columns: ["id"] }],
59
+ lec_ameli: [{ name: "idx_id", columns: ["id"] }],
60
+ mot: [{ name: "idx_id", columns: ["id"] }],
61
+ avicom: [{ name: "idx_id", columns: ["id"] }],
62
+ avigvt: [{ name: "idx_id", columns: ["id"] }],
63
+ sor: [{ name: "idx_id", columns: ["id"] }],
64
+ irr: [{ name: "idx_id", columns: ["id"] }],
65
+ com_ameli: [{ name: "idx_entid", columns: ["entid"] }],
66
+ cab: [{ name: "idx_entid", columns: ["entid"] }],
97
67
  amd: [
98
68
  { name: "idx_subid", columns: ["subid"] },
99
69
  { name: "idx_typrectid", columns: ["typrectid"] },
@@ -117,19 +87,13 @@ export const datasets = {
117
87
  { name: "idx_datsea", columns: ["datsea"] },
118
88
  { name: "idx_typseccod", columns: ["typseccod"] },
119
89
  ],
120
- intpjl: [
121
- { name: "idx_secdiscle", columns: ["secdiscle"] },
122
- ],
90
+ intpjl: [{ name: "idx_secdiscle", columns: ["secdiscle"] }],
123
91
  secdivers: [
124
92
  { name: "idx_datsea", columns: ["datsea"] },
125
93
  { name: "idx_typseccod", columns: ["typseccod"] },
126
94
  ],
127
- intdivers: [
128
- { name: "idx_intdiverscle", columns: ["intdiverscle"] },
129
- ],
130
- lecassdeb: [
131
- { name: "idx_datsea", columns: ["datsea"] },
132
- ],
95
+ intdivers: [{ name: "idx_intdiverscle", columns: ["intdiverscle"] }],
96
+ lecassdeb: [{ name: "idx_datsea", columns: ["datsea"] }],
133
97
  },
134
98
  },
135
99
  dosleg: {
@@ -138,25 +102,15 @@ export const datasets = {
138
102
  title: "Dossiers législatifs",
139
103
  url: "https://data.senat.fr/data/dosleg/dosleg.zip",
140
104
  indexes: {
141
- amescr: [
142
- { name: "idx_scrnum", columns: ["scrnum"] },
143
- ],
144
- auteur: [
145
- { name: "idx_autcod", columns: ["autcod"] },
146
- ],
147
- corscr: [
148
- { name: "idx_scrnum", columns: ["scrnum"] },
149
- ],
105
+ amescr: [{ name: "idx_scrnum", columns: ["scrnum"] }],
106
+ auteur: [{ name: "idx_autcod", columns: ["autcod"] }],
107
+ corscr: [{ name: "idx_scrnum", columns: ["scrnum"] }],
150
108
  date_seance: [
151
109
  { name: "idx_code", columns: ["code"] },
152
110
  { name: "idx_lecidt", columns: ["lecidt"] },
153
111
  ],
154
- deccoc: [
155
- { name: "idx_deccoccod", columns: ["deccoccod"] },
156
- ],
157
- etaloi: [
158
- { name: "idx_etaloicod", columns: ["etaloicod"] },
159
- ],
112
+ deccoc: [{ name: "idx_deccoccod", columns: ["deccoccod"] }],
113
+ etaloi: [{ name: "idx_etaloicod", columns: ["etaloicod"] }],
160
114
  lecass: [
161
115
  { name: "idx_lecidt", columns: ["lecidt"] },
162
116
  { name: "idx_codass", columns: ["codass"] },
@@ -182,42 +136,28 @@ export const datasets = {
182
136
  { name: "idx_thecle", columns: ["thecle"] },
183
137
  { name: "idx_loicod", columns: ["loicod"] },
184
138
  ],
185
- posvot: [
186
- { name: "idx_posvotcod", columns: ["posvotcod"] },
187
- ],
139
+ posvot: [{ name: "idx_posvotcod", columns: ["posvotcod"] }],
188
140
  rap: [
189
141
  { name: "idx_rapcod", columns: ["rapcod"] },
190
142
  { name: "idx_coddenrap", columns: ["coddenrap"] },
191
143
  ],
192
- rolsig: [
193
- { name: "idx_signataire", columns: ["signataire"] },
194
- ],
144
+ rolsig: [{ name: "idx_signataire", columns: ["signataire"] }],
195
145
  scr: [
196
146
  { name: "idx_code", columns: ["code"] },
197
147
  { name: "idx_scrnum", columns: ["scrnum"] },
198
148
  { name: "idx_sesann", columns: ["sesann"] },
199
149
  ],
200
- stavot: [
201
- { name: "idx_stavotidt", columns: ["stavotidt"] },
202
- ],
150
+ stavot: [{ name: "idx_stavotidt", columns: ["stavotidt"] }],
203
151
  texte: [
204
152
  { name: "idx_lecassidt", columns: ["lecassidt"] },
205
153
  { name: "idx_oritxtcod", columns: ["oritxtcod"] },
206
154
  { name: "idx_typtxtcod", columns: ["typtxtcod"] },
207
155
  { name: "idx_texcod", columns: ["texcod"] },
208
156
  ],
209
- the: [
210
- { name: "idx_thecle", columns: ["thecle"] },
211
- ],
212
- titsen: [
213
- { name: "idx_titsencod", columns: ["titsencod"] },
214
- ],
215
- typloi: [
216
- { name: "idx_typloicod", columns: ["typloicod"] },
217
- ],
218
- typtxt: [
219
- { name: "idx_typtxtcod", columns: ["typtxtcod"] },
220
- ],
157
+ the: [{ name: "idx_thecle", columns: ["thecle"] }],
158
+ titsen: [{ name: "idx_titsencod", columns: ["titsencod"] }],
159
+ typloi: [{ name: "idx_typloicod", columns: ["typloicod"] }],
160
+ typtxt: [{ name: "idx_typtxtcod", columns: ["typtxtcod"] }],
221
161
  votsen: [
222
162
  { name: "idx_scrnum", columns: ["scrnum"] },
223
163
  { name: "idx_sesann", columns: ["sesann"] },
@@ -234,22 +174,14 @@ export const datasets = {
234
174
  title: "Questions écrites et orales posées par les sénateurs au Gouvernement",
235
175
  url: "https://data.senat.fr/data/questions/questions.zip",
236
176
  indexes: {
237
- tam_reponses: [
238
- { name: "idx_idque", columns: ["idque"] },
239
- ],
177
+ tam_reponses: [{ name: "idx_idque", columns: ["idque"] }],
240
178
  tam_questions: [
241
179
  { name: "idx_sorquecod", columns: ["sorquecod"] },
242
180
  { name: "idx_etaquecod", columns: ["etaquecod"] },
243
181
  ],
244
- the: [
245
- { name: "idx_thenouidt", columns: ["thenouidt"] },
246
- ],
247
- sortquestion: [
248
- { name: "idx_sorquecod", columns: ["sorquecod"] },
249
- ],
250
- etatquestion: [
251
- { name: "idx_etaquecod", columns: ["etaquecod"] },
252
- ],
182
+ the: [{ name: "idx_thenouidt", columns: ["thenouidt"] }],
183
+ sortquestion: [{ name: "idx_sorquecod", columns: ["sorquecod"] }],
184
+ etatquestion: [{ name: "idx_etaquecod", columns: ["etaquecod"] }],
253
185
  },
254
186
  },
255
187
  sens: {
@@ -268,18 +200,10 @@ export const datasets = {
268
200
  { name: "idx_dptnum", columns: ["dptnum"] },
269
201
  { name: "idx_regcod", columns: ["regcod"] },
270
202
  ],
271
- activite_loi: [
272
- { name: "idx_actid", columns: ["actid"] },
273
- ],
274
- activite_delegation: [
275
- { name: "idx_actid", columns: ["actid"] },
276
- ],
277
- activite_participant: [
278
- { name: "idx_senmat", columns: ["senmat"] },
279
- ],
280
- activite_senateur: [
281
- { name: "idx_senmat", columns: ["senmat"] },
282
- ],
203
+ activite_loi: [{ name: "idx_actid", columns: ["actid"] }],
204
+ activite_delegation: [{ name: "idx_actid", columns: ["actid"] }],
205
+ activite_participant: [{ name: "idx_senmat", columns: ["senmat"] }],
206
+ activite_senateur: [{ name: "idx_senmat", columns: ["senmat"] }],
283
207
  senbur: [
284
208
  { name: "idx_senmat", columns: ["senmat"] },
285
209
  { name: "idx_burcod", columns: ["burcod"] },
package/lib/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export type { AmendementResult, } from "./model/ameli";
2
- export type { DossierLegislatifResult, } from "./model/dosleg";
3
- export type { ScrutinResult, } from "./model/scrutins";
4
- export type { QuestionResult, } from "./model/questions";
5
- export type { CirconscriptionResult, OrganismeResult, SenateurResult, } from "./model/sens";
1
+ export type { AmendementResult } from "./model/ameli";
2
+ export type { DossierLegislatifResult } from "./model/dosleg";
3
+ export type { ScrutinResult } from "./model/scrutins";
4
+ export type { QuestionResult } from "./model/questions";
5
+ export type { CirconscriptionResult, OrganismeResult, SenateurResult } from "./model/sens";
6
6
  export type { AgendaEvent, GroupedReunion } from "./types/agenda";
7
7
  export type { Ses, Sub, TxtAmeli } from "./types/ameli";
8
8
  export type { CompteRendu } from "./types/compte_rendu";
@@ -19,7 +19,7 @@ function auteurs(amendementId) {
19
19
  "ameli.grppol_ameli.libcou as groupe_politique_libelle_court",
20
20
  "ameli.grppol_ameli.lilcou as groupe_politique_libelle",
21
21
  ])
22
- .orderBy("ameli.amdsen.rng asc"));
22
+ .orderBy("ameli.amdsen.rng", "asc"));
23
23
  }
24
24
  const findAllAmendementsQuery = dbSenat
25
25
  .selectFrom("ameli.amd")
@@ -15,9 +15,9 @@ function sectionsLegislatives(dateSeance) {
15
15
  "debats.typsec.typseclib as type",
16
16
  "debats.typsec.typseccat as categorie",
17
17
  interventionsLegislatives(ref("debats.secdis.secdiscle")).as("interventions"),
18
- "debats.secdis.lecassidt as lecture_id"
18
+ "debats.secdis.lecassidt as lecture_id",
19
19
  ])
20
- .orderBy("debats.secdis.secdisordid asc"));
20
+ .orderBy("debats.secdis.secdisordid", "asc"));
21
21
  }
22
22
  function interventionsLegislatives(sectionId) {
23
23
  return jsonArrayFrom(dbSenat
@@ -34,10 +34,10 @@ function interventionsLegislatives(sectionId) {
34
34
  code: ref("dosleg.auteur.autcod"),
35
35
  nom: ref("dosleg.auteur.nomuse"),
36
36
  prenom: ref("dosleg.auteur.prenom"),
37
- matricule: ref("dosleg.auteur.autmat")
38
- }).as("auteur")
37
+ matricule: ref("dosleg.auteur.autmat"),
38
+ }).as("auteur"),
39
39
  ])
40
- .orderBy("debats.intpjl.intordid asc"));
40
+ .orderBy("debats.intpjl.intordid", "asc"));
41
41
  }
42
42
  function sectionsNonLegislatives(dateSeance) {
43
43
  return jsonArrayFrom(dbSenat
@@ -67,10 +67,10 @@ function interventionsNonLegislatives(sectionId) {
67
67
  code: ref("dosleg.auteur.autcod"),
68
68
  nom: ref("dosleg.auteur.nomuse"),
69
69
  prenom: ref("dosleg.auteur.prenom"),
70
- matricule: ref("dosleg.auteur.autmat")
71
- }).as("auteur")
70
+ matricule: ref("dosleg.auteur.autmat"),
71
+ }).as("auteur"),
72
72
  ])
73
- .orderBy("debats.intdivers.intdiversordid asc"));
73
+ .orderBy("debats.intdivers.intdiversordid", "asc"));
74
74
  }
75
75
  function lecturesAssemblee(dateSeance) {
76
76
  return jsonArrayFrom(dbSenat
@@ -10,9 +10,7 @@ function datesSeances(lectureAssembleeId) {
10
10
  .withSchema("dosleg")
11
11
  .selectFrom("dosleg.date_seance")
12
12
  .where("dosleg.date_seance.lecidt", "=", lectureAssembleeId)
13
- .select(({ ref }) => [
14
- toDateString(ref("dosleg.date_seance.date_s")).as("date"),
15
- ]));
13
+ .select(({ ref }) => [toDateString(ref("dosleg.date_seance.date_s")).as("date")]));
16
14
  }
17
15
  function auteursRapport(rapportId) {
18
16
  return jsonArrayFrom(dbSenat
@@ -27,7 +25,7 @@ function auteursRapport(rapportId) {
27
25
  "dosleg.auteur.autmat as matricule",
28
26
  "dosleg.ecr.ecrnumtri as ordre",
29
27
  "dosleg.rolsig.rolsiglib as role",
30
- "dosleg.ecr.ecrqua as qualite"
28
+ "dosleg.ecr.ecrqua as qualite",
31
29
  ])
32
30
  .orderBy("dosleg.ecr.ecrnumtri", "asc"));
33
31
  }
@@ -73,7 +71,7 @@ function auteursTexte(texteId) {
73
71
  "auteur.autmat as matricule",
74
72
  "ecr.ecrnumtri as ordre",
75
73
  "rolsig.rolsiglib as role",
76
- "ecr.ecrqua as qualite"
74
+ "ecr.ecrqua as qualite",
77
75
  ])
78
76
  .orderBy("ecr.ecrnumtri", "asc"));
79
77
  }
@@ -158,9 +156,7 @@ function themes(loiId) {
158
156
  .selectFrom("the")
159
157
  .leftJoin("loithe", "loithe.thecle", "the.thecle")
160
158
  .where("loithe.loicod", "=", loiId)
161
- .select([
162
- "the.thelib as libelle",
163
- ]));
159
+ .select(["the.thelib as libelle"]));
164
160
  }
165
161
  const findAllDossiersQuery = dbSenat
166
162
  .withSchema("dosleg")
@@ -228,17 +224,17 @@ export function createActesLegislatifs(dossier) {
228
224
  const codeParent = getCodeActeLecture(dossier["code_nature_dossier"], lecture["type_lecture"], lectureAss["assemblee"]);
229
225
  const textesWithCodeActe = (lectureAss["textes"] || []).map((texte) => ({
230
226
  code_acte: getCodeActeTexte(codeParent, texte["origine"]),
231
- ...texte
227
+ ...texte,
232
228
  }));
233
229
  // Ajout étape -COM-FOND après chaque -DEPOT
234
230
  let textesWithComFond = [];
235
231
  for (let i = 0; i < textesWithCodeActe.length; i++) {
236
232
  const t = textesWithCodeActe[i];
237
233
  textesWithComFond.push(t);
238
- if (t.code_acte && t.code_acte.endsWith('-DEPOT')) {
234
+ if (t.code_acte && t.code_acte.endsWith("-DEPOT")) {
239
235
  textesWithComFond.push({
240
236
  ...t,
241
- code_acte: t.code_acte.replace('-DEPOT', '-COM-FOND')
237
+ code_acte: t.code_acte.replace("-DEPOT", "-COM-FOND"),
242
238
  });
243
239
  }
244
240
  }
@@ -260,7 +256,8 @@ export function createActesLegislatifs(dossier) {
260
256
  ordre_lecture: null,
261
257
  libelle_lecture: "Conseil constitutionnel",
262
258
  code_acte: "CC",
263
- actes_legislatifs: [{
259
+ actes_legislatifs: [
260
+ {
264
261
  code_acte: "CC-SAISIE",
265
262
  date: dossier["date_saisine_CoC"],
266
263
  libelle_decision_CoC: dossier["libelle_decision_CoC"],
@@ -270,7 +267,8 @@ export function createActesLegislatifs(dossier) {
270
267
  url_dossier_CoC: dossier["url_dossier_CoC"],
271
268
  date_saisine_CoC: dossier["date_saisine_CoC"],
272
269
  condition_saisine_CoC: dossier["condition_saisine_CoC"],
273
- }]
270
+ },
271
+ ],
274
272
  });
275
273
  }
276
274
  if (dossier["date_publication_JO"]) {
@@ -279,14 +277,16 @@ export function createActesLegislatifs(dossier) {
279
277
  ordre_lecture: null,
280
278
  libelle_lecture: "Promulgation",
281
279
  code_acte: "PROM",
282
- actes_legislatifs: [{
280
+ actes_legislatifs: [
281
+ {
283
282
  code_acte: "PROM-PUB",
284
283
  date: dossier["date_publication_JO"],
285
284
  titre_JO: dossier["titre_JO"],
286
285
  date_publication_JO: dossier["date_publication_JO"],
287
286
  numero_JO: dossier["numero_JO"],
288
- url_JO: dossier["url_JO"]
289
- }]
287
+ url_JO: dossier["url_JO"],
288
+ },
289
+ ],
290
290
  });
291
291
  }
292
292
  return actesLegislatifs;
@@ -327,22 +327,31 @@ export function getCodeActeTexte(codeParent, texteOrigine) {
327
327
  if (texteOrigine === "de la commission") {
328
328
  return "CMP-DEBATS-AN";
329
329
  }
330
- else if (texteOrigine === "adopté par l'Assemblée Nationale" || texteOrigine === "adopté par l'Assemblée nationale") {
330
+ else if (texteOrigine === "adopté par l'Assemblée Nationale" ||
331
+ texteOrigine === "adopté par l'Assemblée nationale") {
331
332
  return "CMP-DEBATS-SN";
332
333
  }
333
334
  }
334
- if (texteOrigine === "transmis au Sénat" || texteOrigine === "déposé au Sénat" ||
335
- texteOrigine === "transmis à l'Assemblée nationale" || texteOrigine === "déposé à l'Assemblée nationale" ||
336
- texteOrigine === "transmis à l'Assemblée Nationale" || texteOrigine === "déposé à l'Assemblée Nationale") {
335
+ if (texteOrigine === "transmis au Sénat" ||
336
+ texteOrigine === "déposé au Sénat" ||
337
+ texteOrigine === "transmis à l'Assemblée nationale" ||
338
+ texteOrigine === "déposé à l'Assemblée nationale" ||
339
+ texteOrigine === "transmis à l'Assemblée Nationale" ||
340
+ texteOrigine === "déposé à l'Assemblée Nationale") {
337
341
  return `${codeParent}-DEPOT`;
338
342
  }
339
- if (texteOrigine === "de la commission" || texteOrigine === "de la commission (AN)" || texteOrigine === "résultat des travaux de la commission") {
343
+ if (texteOrigine === "de la commission" ||
344
+ texteOrigine === "de la commission (AN)" ||
345
+ texteOrigine === "résultat des travaux de la commission") {
340
346
  return `${codeParent}-DEBATS-SEANCE`;
341
347
  }
342
348
  if (texteOrigine === "retiré par l'auteur") {
343
349
  return `${codeParent}-RTRINI`;
344
350
  }
345
- if (texteOrigine.includes("adopté") || texteOrigine.includes("rejeté") || texteOrigine.includes("modifié") || texteOrigine === "devenu résolution du Sénat") {
351
+ if (texteOrigine.includes("adopté") ||
352
+ texteOrigine.includes("rejeté") ||
353
+ texteOrigine.includes("modifié") ||
354
+ texteOrigine === "devenu résolution du Sénat") {
346
355
  return `${codeParent}-DEBATS-DEC`;
347
356
  }
348
357
  return null;
@@ -1,7 +1,7 @@
1
1
  export { findAllAmendements } from "./ameli";
2
2
  export { findAll as findAllDebats } from "./debats";
3
- export { findAllDossiers, } from "./dosleg";
3
+ export { findAllDossiers } from "./dosleg";
4
4
  export { findSenatTexteUrls, findSenatRapportUrls } from "./documents";
5
5
  export { findAllScrutins } from "./scrutins";
6
6
  export { findAll as findAllQuestions } from "./questions";
7
- export { findAll as findAllSens, findAllCirconscriptions, findAllOrganismes, } from "./sens";
7
+ export { findAll as findAllSens, findAllCirconscriptions, findAllOrganismes } from "./sens";
@@ -1,7 +1,7 @@
1
1
  export { findAllAmendements } from "./ameli";
2
2
  export { findAll as findAllDebats } from "./debats";
3
- export { findAllDossiers, } from "./dosleg";
3
+ export { findAllDossiers } from "./dosleg";
4
4
  export { findSenatTexteUrls, findSenatRapportUrls } from "./documents";
5
5
  export { findAllScrutins } from "./scrutins";
6
6
  export { findAll as findAllQuestions } from "./questions";
7
- export { findAll as findAllSens, findAllCirconscriptions, findAllOrganismes, } from "./sens";
7
+ export { findAll as findAllSens, findAllCirconscriptions, findAllOrganismes } from "./sens";
@@ -16,7 +16,7 @@ function reponses(questionId) {
16
16
  "tam_reponses.txtrep as texte",
17
17
  "tam_reponses.txterrrep as texte_erratum",
18
18
  ])
19
- .orderBy("tam_reponses.datejorep asc"));
19
+ .orderBy("tam_reponses.datejorep", "asc"));
20
20
  }
21
21
  function themes(questionId) {
22
22
  return jsonArrayFrom(dbSenat
@@ -25,15 +25,13 @@ function themes(questionId) {
25
25
  .selectFrom("tam_questions")
26
26
  .select(({ eb, ref, val }) => [
27
27
  "id as question_id",
28
- eb
29
- .cast(expandToRows(ref("tam_questions.themes"), val("#(\\d+)")), "smallint")
30
- .as("theme_id"),
28
+ eb.cast(expandToRows(ref("tam_questions.themes"), val("#(\\d+)")), "smallint").as("theme_id"),
31
29
  ]))
32
30
  .selectFrom("the")
33
31
  .leftJoin("question_theme", "the.thenouidt", "question_theme.theme_id")
34
32
  .where("question_theme.question_id", "=", questionId)
35
33
  .select("the.thelib as libelle")
36
- .orderBy("the.thenouidt asc"));
34
+ .orderBy("the.thenouidt", "asc"));
37
35
  }
38
36
  const findAllQuery = dbSenat
39
37
  .withSchema("questions")
@@ -13,7 +13,7 @@ function votes(scrutinNum, scrutinSession, scrutinDate) {
13
13
  .onRef("sens.memgrppol.memgrppoldatdeb", "<=", scrutinDate)
14
14
  .on((eb) => eb.or([
15
15
  eb("sens.memgrppol.memgrppoldatfin", ">=", scrutinDate),
16
- eb("sens.memgrppol.memgrppoldatfin", "is", null)
16
+ eb("sens.memgrppol.memgrppoldatfin", "is", null),
17
17
  ])))
18
18
  .where("dosleg.votsen.scrnum", "=", scrutinNum)
19
19
  .where("dosleg.votsen.sesann", "=", scrutinSession)
@@ -39,7 +39,7 @@ function groupesVotants(scrutinNum, scrutinSession, scrutinDate) {
39
39
  .onRef("sens.memgrppol.memgrppoldatdeb", "<=", scrutinDate)
40
40
  .on((eb) => eb.or([
41
41
  eb("sens.memgrppol.memgrppoldatfin", ">=", scrutinDate),
42
- eb("sens.memgrppol.memgrppoldatfin", "is", null)
42
+ eb("sens.memgrppol.memgrppoldatfin", "is", null),
43
43
  ])))
44
44
  .where("dosleg.votsen.scrnum", "=", scrutinNum)
45
45
  .where("dosleg.votsen.sesann", "=", scrutinSession)
@@ -51,31 +51,17 @@ function groupesVotants(scrutinNum, scrutinSession, scrutinDate) {
51
51
  "sens.memgrppol.grppolcod",
52
52
  ])
53
53
  .as("unique_votes"))
54
- .groupBy([
55
- "unique_votes.grppolcod",
56
- ])
54
+ .groupBy(["unique_votes.grppolcod"])
57
55
  .select(({ fn, eb }) => [
58
56
  "unique_votes.grppolcod as groupe_politique_code",
59
- fn.sum(eb.case()
60
- .when("unique_votes.posvotlib", "=", "pour")
61
- .then(1)
62
- .else(0)
63
- .end()).as("nombre_pour"),
64
- fn.sum(eb.case()
65
- .when("unique_votes.posvotlib", "=", "contre")
66
- .then(1)
67
- .else(0)
68
- .end()).as("nombre_contre"),
69
- fn.sum(eb.case()
70
- .when("unique_votes.posvotlib", "=", "abstention")
71
- .then(1)
72
- .else(0)
73
- .end()).as("nombre_abstentions"),
74
- fn.sum(eb.case()
75
- .when("unique_votes.posvotlib", "=", "non-votant")
76
- .then(1)
77
- .else(0)
78
- .end()).as("nombre_non_votants"),
57
+ fn.sum(eb.case().when("unique_votes.posvotlib", "=", "pour").then(1).else(0).end()).as("nombre_pour"),
58
+ fn.sum(eb.case().when("unique_votes.posvotlib", "=", "contre").then(1).else(0).end()).as("nombre_contre"),
59
+ fn
60
+ .sum(eb.case().when("unique_votes.posvotlib", "=", "abstention").then(1).else(0).end())
61
+ .as("nombre_abstentions"),
62
+ fn
63
+ .sum(eb.case().when("unique_votes.posvotlib", "=", "non-votant").then(1).else(0).end())
64
+ .as("nombre_non_votants"),
79
65
  fn.count("unique_votes.senmat").as("nombre_votants"),
80
66
  ]));
81
67
  }
@@ -84,11 +70,7 @@ function misesAuPoint(scrutinNum) {
84
70
  .withSchema("dosleg")
85
71
  .selectFrom("corscr")
86
72
  .where("corscr.scrnum", "=", scrutinNum)
87
- .select([
88
- "corscr.corscrtxt as texte",
89
- "corscr.corscrord as ordre",
90
- "corscr.corscrurl as url",
91
- ]));
73
+ .select(["corscr.corscrtxt as texte", "corscr.corscrord as ordre", "corscr.corscrurl as url"]));
92
74
  }
93
75
  const findAllScrutinsQuery = dbSenat
94
76
  .withSchema("dosleg")
@@ -124,9 +106,7 @@ const findAllScrutinsQuery = dbSenat
124
106
  .$narrowType();
125
107
  export function findAllScrutins(fromSession) {
126
108
  if (fromSession !== undefined) {
127
- return findAllScrutinsQuery
128
- .where("scr.sesann", ">=", fromSession)
129
- .stream();
109
+ return findAllScrutinsQuery.where("scr.sesann", ">=", fromSession).stream();
130
110
  }
131
111
  return findAllScrutinsQuery.stream();
132
112
  }