@tricoteuses/senat 2.10.3 → 2.10.4

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/LICENSE.md CHANGED
@@ -1,22 +1,22 @@
1
- # Tricoteuses-Senat
2
-
3
- ## _Handle French Sénat's open data_
4
-
5
- By: Emmanuel Raviart <mailto:emmanuel@raviart.com>
6
-
7
- Copyright (C) 2019, 2020, 2021 Emmanuel Raviart
8
-
9
- https://git.tricoteuses.fr/logiciels/tricoteuses-senat
10
-
11
- > Tricoteuses-Senat is free software; you can redistribute it and/or modify
12
- > it under the terms of the GNU Affero General Public License as
13
- > published by the Free Software Foundation, either version 3 of the
14
- > License, or (at your option) any later version.
15
- >
16
- > Tricoteuses-Senat is distributed in the hope that it will be useful,
17
- > but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- > GNU Affero General Public License for more details.
20
- >
21
- > You should have received a copy of the GNU Affero General Public License
22
- > along with this program. If not, see <http://www.gnu.org/licenses/>.
1
+ # Tricoteuses-Senat
2
+
3
+ ## _Handle French Sénat's open data_
4
+
5
+ By: Emmanuel Raviart <mailto:emmanuel@raviart.com>
6
+
7
+ Copyright (C) 2019, 2020, 2021 Emmanuel Raviart
8
+
9
+ https://git.tricoteuses.fr/logiciels/tricoteuses-senat
10
+
11
+ > Tricoteuses-Senat is free software; you can redistribute it and/or modify
12
+ > it under the terms of the GNU Affero General Public License as
13
+ > published by the Free Software Foundation, either version 3 of the
14
+ > License, or (at your option) any later version.
15
+ >
16
+ > Tricoteuses-Senat is distributed in the hope that it will be useful,
17
+ > but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ > GNU Affero General Public License for more details.
20
+ >
21
+ > You should have received a copy of the GNU Affero General Public License
22
+ > along with this program. If not, see <http://www.gnu.org/licenses/>.
package/README.md CHANGED
@@ -1,116 +1,116 @@
1
- # Tricoteuses-Senat
2
-
3
- ## _Retrieve, clean up & handle French Sénat's open data_
4
-
5
- ## Requirements
6
-
7
- - Node >= 22
8
-
9
- ## Installation
10
-
11
- ```bash
12
- git clone https://git.tricoteuses.fr/logiciels/tricoteuses-senat
13
- cd tricoteuses-senat/
14
- ```
15
-
16
- Create a `.env` file to set PostgreSQL database informations and other configuration variables (you can use `example.env` as a template). Then
17
-
18
- ```bash
19
- npm install
20
- ```
21
-
22
- ### Database creation (not needed if downloading with Docker image)
23
-
24
- #### Using Docker
25
-
26
- ```bash
27
- docker run --name local-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=$YOUR_CUSTOM_DB_PASSWORD postgres
28
- # Default Postgres user is postgres
29
- # But scripts require an "opendata" role
30
- docker exec -it local-postgres psql -U postgres -c "CREATE ROLE opendata;"
31
- ```
32
-
33
- ## Download data
34
-
35
- Create a folder where the data will be downloaded and run the following command to download the data and convert it into JSON files.
36
-
37
- ```bash
38
- mkdir ../senat-data/
39
-
40
- # Available options for optional `categories` parameter : All, Ameli, Debats, DosLeg, Questions, Sens
41
- npm run data:download ../senat-data -- [--categories All]
42
- ```
43
-
44
- Data from other sources is also available :
45
- ```bash
46
- # Retrieval of textes and rapports from Sénat's website
47
- # Available options for optional `formats` parameter : xml, html, pdf
48
- # Available options for optional `types` parameter : textes, rapports
49
- npm run data:retrieve_documents ../senat-data -- --fromSession 2022 [--formats xml pdf] [--types textes]
50
-
51
- # Retrieval & parsing (textes in xml format only for now)
52
- npm run data:retrieve_documents ../senat-data -- --fromSession 2022 --parseDocuments
53
-
54
- # Parsing only
55
- npm run data:parse_textes_lois ../senat-data
56
-
57
- # Retrieval (& parsing) of agenda from Sénat's website
58
- npm run data:retrieve_agenda ../senat-data -- --fromSession 2022 [--parseAgenda]
59
-
60
- # Retrieval (& parsing) of comptes-rendus des débats from Sénat's website
61
- npm run data:retrieve_comptes_rendus ../senat-data -- [--parseDebats]
62
-
63
- # Retrieval of sénateurs' pictures from Sénat's website
64
- npm run data:retrieve_senateurs_photos ../senat-data
65
- ```
66
-
67
- ## Data download using Docker
68
-
69
- A Docker image that downloads and converts the data all at once is available. Build it locally or run it from the container registry.
70
- Use the environment variables `FROM_SESSION` and `CATEGORIES` if needed.
71
-
72
- ```bash
73
- docker run --pull always --name tricoteuses-senat -v ../senat-data:/app/senat-data -d git.tricoteuses.fr/logiciels/tricoteuses-senat:latest
74
- ```
75
-
76
- Use the environment variable `CATEGORIES` and `FROM_SESSION` if needed.
77
-
78
- ## Using the data
79
-
80
- Once the data is downloaded, you can use loaders to retrieve it.
81
- To use loaders in your project, you can install the _@tricoteuses/senat_ package, and import the iterator functions that you need.
82
-
83
- ```bash
84
- npm install @tricoteuses/senat
85
- ```
86
-
87
- ```js
88
- import { iterLoadSenatQuestions } from "@tricoteuses/senat/loaders"
89
-
90
- // Pass data directory and legislature as arguments
91
- for (const { item: question } of iterLoadSenatQuestions("../senat-data", 17)) {
92
- console.log(question.id)
93
- }
94
- ```
95
-
96
- ## Generation of raw types from SQL schema (for contributors only)
97
-
98
- ```bash
99
- npm run data:generate_schemas ../senat-data
100
- ```
101
-
102
- ## Publishing
103
-
104
- To publish a new version of this package onto npm, bump the package version and publish.
105
-
106
- ```bash
107
- npm version x.y.z # Bumps version in package.json and creates a new tag x.y.z
108
- npx tsc
109
- npm publish
110
- ```
111
-
112
- The Docker image will be automatically built during a CI Workflow if you push the tag to the remote repository.
113
-
114
- ```bash
115
- git push --tags
116
- ```
1
+ # Tricoteuses-Senat
2
+
3
+ ## _Retrieve, clean up & handle French Sénat's open data_
4
+
5
+ ## Requirements
6
+
7
+ - Node >= 22
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ git clone https://git.tricoteuses.fr/logiciels/tricoteuses-senat
13
+ cd tricoteuses-senat/
14
+ ```
15
+
16
+ Create a `.env` file to set PostgreSQL database informations and other configuration variables (you can use `example.env` as a template). Then
17
+
18
+ ```bash
19
+ npm install
20
+ ```
21
+
22
+ ### Database creation (not needed if downloading with Docker image)
23
+
24
+ #### Using Docker
25
+
26
+ ```bash
27
+ docker run --name local-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=$YOUR_CUSTOM_DB_PASSWORD postgres
28
+ # Default Postgres user is postgres
29
+ # But scripts require an "opendata" role
30
+ docker exec -it local-postgres psql -U postgres -c "CREATE ROLE opendata;"
31
+ ```
32
+
33
+ ## Download data
34
+
35
+ Create a folder where the data will be downloaded and run the following command to download the data and convert it into JSON files.
36
+
37
+ ```bash
38
+ mkdir ../senat-data/
39
+
40
+ # Available options for optional `categories` parameter : All, Ameli, Debats, DosLeg, Questions, Sens
41
+ npm run data:download ../senat-data -- [--categories All]
42
+ ```
43
+
44
+ Data from other sources is also available :
45
+ ```bash
46
+ # Retrieval of textes and rapports from Sénat's website
47
+ # Available options for optional `formats` parameter : xml, html, pdf
48
+ # Available options for optional `types` parameter : textes, rapports
49
+ npm run data:retrieve_documents ../senat-data -- --fromSession 2022 [--formats xml pdf] [--types textes]
50
+
51
+ # Retrieval & parsing (textes in xml format only for now)
52
+ npm run data:retrieve_documents ../senat-data -- --fromSession 2022 --parseDocuments
53
+
54
+ # Parsing only
55
+ npm run data:parse_textes_lois ../senat-data
56
+
57
+ # Retrieval (& parsing) of agenda from Sénat's website
58
+ npm run data:retrieve_agenda ../senat-data -- --fromSession 2022 [--parseAgenda]
59
+
60
+ # Retrieval (& parsing) of comptes-rendus des débats from Sénat's website
61
+ npm run data:retrieve_comptes_rendus ../senat-data -- [--parseDebats]
62
+
63
+ # Retrieval of sénateurs' pictures from Sénat's website
64
+ npm run data:retrieve_senateurs_photos ../senat-data
65
+ ```
66
+
67
+ ## Data download using Docker
68
+
69
+ A Docker image that downloads and converts the data all at once is available. Build it locally or run it from the container registry.
70
+ Use the environment variables `FROM_SESSION` and `CATEGORIES` if needed.
71
+
72
+ ```bash
73
+ docker run --pull always --name tricoteuses-senat -v ../senat-data:/app/senat-data -d git.tricoteuses.fr/logiciels/tricoteuses-senat:latest
74
+ ```
75
+
76
+ Use the environment variable `CATEGORIES` and `FROM_SESSION` if needed.
77
+
78
+ ## Using the data
79
+
80
+ Once the data is downloaded, you can use loaders to retrieve it.
81
+ To use loaders in your project, you can install the _@tricoteuses/senat_ package, and import the iterator functions that you need.
82
+
83
+ ```bash
84
+ npm install @tricoteuses/senat
85
+ ```
86
+
87
+ ```js
88
+ import { iterLoadSenatQuestions } from "@tricoteuses/senat/loaders"
89
+
90
+ // Pass data directory and legislature as arguments
91
+ for (const { item: question } of iterLoadSenatQuestions("../senat-data", 17)) {
92
+ console.log(question.id)
93
+ }
94
+ ```
95
+
96
+ ## Generation of raw types from SQL schema (for contributors only)
97
+
98
+ ```bash
99
+ npm run data:generate_schemas ../senat-data
100
+ ```
101
+
102
+ ## Publishing
103
+
104
+ To publish a new version of this package onto npm, bump the package version and publish.
105
+
106
+ ```bash
107
+ npm version x.y.z # Bumps version in package.json and creates a new tag x.y.z
108
+ npx tsc
109
+ npm publish
110
+ ```
111
+
112
+ The Docker image will be automatically built during a CI Workflow if you push the tag to the remote repository.
113
+
114
+ ```bash
115
+ git push --tags
116
+ ```
@@ -19,7 +19,8 @@ type QuestionsDb = {
19
19
  type SensDb = {
20
20
  [K in keyof SensTableTypes]: SensTableTypes[K]["select"];
21
21
  };
22
- export declare const dbSenat: Kysely<unknown>;
22
+ export type SenatDb = AmeliDb & DebatsDb & DoslegDb & QuestionsDb & SensDb;
23
+ export declare const dbSenat: Kysely<SenatDb>;
23
24
  export declare const dbAmeli: Kysely<AmeliDb>;
24
25
  export declare const dbDebats: Kysely<DebatsDb>;
25
26
  export declare const dbDosleg: Kysely<DoslegDb>;
@@ -2,7 +2,7 @@ import { InferResult } from "kysely";
2
2
  export type AmendementResult = InferResult<typeof findAllQuery>[0];
3
3
  declare const findAllQuery: import("kysely").SelectQueryBuilder<{
4
4
  amd: import("../raw_types/ameli").Amd;
5
- mot: import("../raw_types/ameli").Mot;
5
+ mot: import("kysely").Nullable<import("../raw_types/ameli").Mot>;
6
6
  sub: import("kysely").Nullable<import("../raw_types/ameli").Sub>;
7
7
  ent: import("../raw_types/ameli").Ent;
8
8
  sor: import("kysely").Nullable<import("../raw_types/ameli").Sor>;
@@ -10,13 +10,13 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
10
10
  avigvt: import("kysely").Nullable<import("../raw_types/ameli").Avigvt>;
11
11
  irr: import("kysely").Nullable<import("../raw_types/ameli").Irr>;
12
12
  txt_ameli: import("kysely").Nullable<import("../raw_types/ameli").TxtAmeli>;
13
- typrect: import("../raw_types/ameli").Typrect;
13
+ typrect: import("kysely").Nullable<import("../raw_types/ameli").Typrect>;
14
14
  amdsen: import("../raw_types/ameli").Amdsen;
15
15
  sen_ameli: import("../raw_types/ameli").SenAmeli;
16
16
  grppol_ameli: import("kysely").Nullable<import("../raw_types/ameli").GrppolAmeli>;
17
17
  cab: import("kysely").Nullable<import("../raw_types/ameli").Cab>;
18
18
  com_ameli: import("kysely").Nullable<import("../raw_types/ameli").ComAmeli>;
19
- etatxt: import("../raw_types/ameli").Etatxt;
19
+ etatxt: import("kysely").Nullable<import("../raw_types/ameli").Etatxt>;
20
20
  fbu: import("../raw_types/ameli").Fbu;
21
21
  ses: import("kysely").Nullable<import("../raw_types/ameli").Ses>;
22
22
  gvt: import("../raw_types/ameli").Gvt;
@@ -27,28 +27,41 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
27
27
  nat: import("kysely").Nullable<import("../raw_types/ameli").Nat>;
28
28
  sai: import("../raw_types/ameli").Sai;
29
29
  saisen: import("../raw_types/ameli").Saisen;
30
- typses: import("../raw_types/ameli").Typses;
30
+ typses: import("kysely").Nullable<import("../raw_types/ameli").Typses>;
31
31
  typsub: import("kysely").Nullable<import("../raw_types/ameli").Typsub>;
32
32
  w_nivrec: import("../raw_types/ameli").WNivrec;
33
- }, "amd" | "sub" | "sor" | "avicom" | "avigvt" | "irr" | "txt_ameli" | "grppol_ameli" | "cab" | "com_ameli" | "ses" | "lec_ameli" | "nat" | "typsub", {
33
+ }, "amd" | "mot" | "sub" | "sor" | "avicom" | "avigvt" | "irr" | "txt_ameli" | "typrect" | "grppol_ameli" | "cab" | "com_ameli" | "etatxt" | "ses" | "lec_ameli" | "nat" | "typses" | "typsub", {
34
34
  session: number | null;
35
+ session_libelle: string | null;
36
+ type_session: string | null;
35
37
  signet_dossier_legislatif: string | null;
36
38
  nature_texte: string | null;
39
+ nature_texte_libelle: string | null;
37
40
  numero_texte: number | null;
38
41
  numero_adoption_texte: number | null;
39
42
  intitule_texte: string | null;
43
+ etat_texte: string | null;
44
+ etat_texte_libelle: string | null;
45
+ type_texte: string | null;
40
46
  lecture: string | null;
41
47
  nature: string;
42
48
  id: number;
43
49
  parent_id: number | null;
44
50
  rendu_similaire_id: number | null;
45
51
  identique_id: number | null;
52
+ discussion_commune_id: number | null;
46
53
  numero: string | null;
47
54
  numero_absolu: number | null;
48
55
  ordre: number | null;
49
56
  accepte_gouvernement: string | null;
50
57
  subdivision_libelle: string | null;
51
58
  subdivision_libelle_court: string | null;
59
+ subdivision_position_texte: number | null;
60
+ subdivision_position_discussion: number | null;
61
+ subdivision_mere_id: number | null;
62
+ subdivision_signet: string | null;
63
+ subdivision_commission_id: number | null;
64
+ subdivision_dupliquee: string | null;
52
65
  subdivision_type: string | null;
53
66
  alinea: number | null;
54
67
  commentaire_probleme: string | null;
@@ -56,8 +69,9 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
56
69
  observations_additionnelles: string | null;
57
70
  date_depot: string;
58
71
  dispositif: string | null;
59
- discussion_commune_id: number | null;
60
72
  objet: string | null;
73
+ type_rectification: string | null;
74
+ motion_libelle: string | null;
61
75
  etat: string;
62
76
  avis_commission: string | null;
63
77
  avis_gouvernement: string | null;
@@ -74,27 +88,44 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
74
88
  qualite: string | null;
75
89
  rang: number | null;
76
90
  matricule: string | null;
91
+ groupe_politique_id: number | null;
92
+ group_politique_code: string | null;
93
+ groupe_politique_libelle_court: string | null;
94
+ groupe_politique_libelle: string | null;
77
95
  }[];
78
96
  }>;
79
97
  export declare function findAll(): AsyncIterableIterator<{
80
98
  session: number | null;
99
+ session_libelle: string | null;
100
+ type_session: string | null;
81
101
  signet_dossier_legislatif: string | null;
82
102
  nature_texte: string | null;
103
+ nature_texte_libelle: string | null;
83
104
  numero_texte: number | null;
84
105
  numero_adoption_texte: number | null;
85
106
  intitule_texte: string | null;
107
+ etat_texte: string | null;
108
+ etat_texte_libelle: string | null;
109
+ type_texte: string | null;
86
110
  lecture: string | null;
87
111
  nature: string;
88
112
  id: number;
89
113
  parent_id: number | null;
90
114
  rendu_similaire_id: number | null;
91
115
  identique_id: number | null;
116
+ discussion_commune_id: number | null;
92
117
  numero: string | null;
93
118
  numero_absolu: number | null;
94
119
  ordre: number | null;
95
120
  accepte_gouvernement: string | null;
96
121
  subdivision_libelle: string | null;
97
122
  subdivision_libelle_court: string | null;
123
+ subdivision_position_texte: number | null;
124
+ subdivision_position_discussion: number | null;
125
+ subdivision_mere_id: number | null;
126
+ subdivision_signet: string | null;
127
+ subdivision_commission_id: number | null;
128
+ subdivision_dupliquee: string | null;
98
129
  subdivision_type: string | null;
99
130
  alinea: number | null;
100
131
  commentaire_probleme: string | null;
@@ -102,8 +133,9 @@ export declare function findAll(): AsyncIterableIterator<{
102
133
  observations_additionnelles: string | null;
103
134
  date_depot: string;
104
135
  dispositif: string | null;
105
- discussion_commune_id: number | null;
106
136
  objet: string | null;
137
+ type_rectification: string | null;
138
+ motion_libelle: string | null;
107
139
  etat: string;
108
140
  avis_commission: string | null;
109
141
  avis_gouvernement: string | null;
@@ -120,6 +152,10 @@ export declare function findAll(): AsyncIterableIterator<{
120
152
  qualite: string | null;
121
153
  rang: number | null;
122
154
  matricule: string | null;
155
+ groupe_politique_id: number | null;
156
+ group_politique_code: string | null;
157
+ groupe_politique_libelle_court: string | null;
158
+ groupe_politique_libelle: string | null;
123
159
  }[];
124
160
  }>;
125
161
  export {};
@@ -5,6 +5,7 @@ function auteurs(amendementId) {
5
5
  return jsonArrayFrom(dbAmeli
6
6
  .selectFrom("amdsen")
7
7
  .leftJoin("sen_ameli", "amdsen.senid", "sen_ameli.entid")
8
+ .leftJoin("grppol_ameli", "amdsen.grpid", "grppol_ameli.entid")
8
9
  .where("amdsen.amdid", "=", amendementId)
9
10
  .select([
10
11
  "amdsen.prenomuse as prenom",
@@ -13,6 +14,10 @@ function auteurs(amendementId) {
13
14
  "amdsen.qua as qualite",
14
15
  "amdsen.rng as rang",
15
16
  "sen_ameli.mat as matricule",
17
+ "amdsen.grpid as groupe_politique_id",
18
+ "grppol_ameli.cod as group_politique_code",
19
+ "grppol_ameli.libcou as groupe_politique_libelle_court",
20
+ "grppol_ameli.lilcou as groupe_politique_libelle",
16
21
  ])
17
22
  .orderBy("amdsen.rng asc"));
18
23
  }
@@ -20,10 +25,14 @@ const findAllQuery = dbAmeli
20
25
  .selectFrom("amd")
21
26
  .leftJoin("sub", "amd.subid", "sub.id")
22
27
  .leftJoin("typsub", "sub.typid", "typsub.id")
28
+ .leftJoin("typrect", "amd.typrectid", "typrect.id")
23
29
  .leftJoin("txt_ameli", "amd.txtid", "txt_ameli.id")
30
+ .leftJoin("etatxt", "txt_ameli.txtetaid", "etatxt.id")
24
31
  .leftJoin("ses", "txt_ameli.sesdepid", "ses.id")
32
+ .leftJoin("typses", "typses.id", "ses.typid")
25
33
  .leftJoin("nat", "txt_ameli.natid", "nat.id")
26
34
  .leftJoin("lec_ameli", "txt_ameli.lecid", "lec_ameli.id")
35
+ .leftJoin("mot", "amd.motid", "mot.id")
27
36
  .leftJoin("avicom", "amd.avcid", "avicom.id")
28
37
  .leftJoin("avigvt", "amd.avgid", "avigvt.id")
29
38
  .leftJoin("sor", "amd.sorid", "sor.id")
@@ -33,11 +42,17 @@ const findAllQuery = dbAmeli
33
42
  .leftJoin("cab", "amd.nomentid", "cab.entid")
34
43
  .select(({ eb, ref, val }) => [
35
44
  "ses.ann as session",
45
+ "ses.lil as session_libelle",
46
+ "typses.lib as type_session",
36
47
  "txt_ameli.doslegsignet as signet_dossier_legislatif",
37
48
  "nat.libcourt as nature_texte",
49
+ "nat.lib as nature_texte_libelle",
38
50
  "txt_ameli.numabs as numero_texte",
39
51
  "txt_ameli.numado as numero_adoption_texte",
40
52
  "txt_ameli.int as intitule_texte",
53
+ "etatxt.lic as etat_texte",
54
+ "etatxt.lib as etat_texte_libelle",
55
+ "etatxt.txttyp as type_texte",
41
56
  "lec_ameli.lib as lecture",
42
57
  eb
43
58
  .case()
@@ -54,12 +69,19 @@ const findAllQuery = dbAmeli
54
69
  "amd.amdperid as parent_id",
55
70
  "amd.amdrendusim as rendu_similaire_id",
56
71
  "amd.ideid as identique_id",
72
+ "amd.discomid as discussion_commune_id",
57
73
  "amd.num as numero",
58
74
  "amd.numabs as numero_absolu",
59
75
  "amd.ord as ordre",
60
76
  "amd.accgou as accepte_gouvernement",
61
77
  "sub.lib as subdivision_libelle",
62
78
  "sub.lic as subdivision_libelle_court",
79
+ "sub.pos as subdivision_position_texte",
80
+ "sub.posder as subdivision_position_discussion",
81
+ "sub.merid as subdivision_mere_id",
82
+ "sub.sig as subdivision_signet",
83
+ "sub.comdelid as subdivision_commission_id",
84
+ "sub.dupl as subdivision_dupliquee",
63
85
  "typsub.lib as subdivision_type",
64
86
  "amd.alinea as alinea",
65
87
  "amd.commentprobleme as commentaire_probleme",
@@ -67,8 +89,9 @@ const findAllQuery = dbAmeli
67
89
  "amd.mot as observations_additionnelles",
68
90
  toDateString(ref("amd.datdep")).as("date_depot"),
69
91
  "amd.dis as dispositif",
70
- "amd.discomid as discussion_commune_id",
71
92
  "amd.obj as objet",
93
+ "typrect.lib as type_rectification",
94
+ "mot.lib as motion_libelle",
72
95
  eb
73
96
  .case()
74
97
  .when("amd.etaid", "=", 7)
@@ -1,15 +1,6 @@
1
1
  import { InferResult } from "kysely";
2
2
  export type DebatResult = InferResult<typeof findAllQuery>[0];
3
- declare const findAllQuery: import("kysely").SelectQueryBuilder<{
4
- debats: import("../raw_types/debats").Debats;
5
- intdivers: import("../raw_types/debats").Intdivers;
6
- intpjl: import("../raw_types/debats").Intpjl;
7
- lecassdeb: import("../raw_types/debats").Lecassdeb;
8
- secdis: import("../raw_types/debats").Secdis;
9
- secdivers: import("../raw_types/debats").Secdivers;
10
- syndeb: import("../raw_types/debats").Syndeb;
11
- typsec: import("../raw_types/debats").Typsec;
12
- }, "debats", {
3
+ declare const findAllQuery: import("kysely").SelectQueryBuilder<import("../databases").SenatDb, "debats", {
13
4
  id: string;
14
5
  date_seance: string;
15
6
  numero: number | null;
@@ -1,9 +1,10 @@
1
1
  import { jsonArrayFrom } from "kysely/helpers/postgres";
2
- import { dbDebats } from "../databases";
2
+ import { dbSenat } from "../databases";
3
3
  import { ID_DATE_FORMAT } from "../scripts/datautil";
4
4
  import { toDateString } from "./util";
5
5
  function sectionsLegislatives(dateSeance) {
6
- return jsonArrayFrom(dbDebats
6
+ return jsonArrayFrom(dbSenat
7
+ .withSchema("debats")
7
8
  .selectFrom("secdis")
8
9
  .leftJoin("typsec", "secdis.typseccod", "typsec.typseccod")
9
10
  .where("secdis.datsea", "=", dateSeance)
@@ -20,7 +21,8 @@ function sectionsLegislatives(dateSeance) {
20
21
  .orderBy("secdis.secdisordid asc"));
21
22
  }
22
23
  function interventionsLegislatives(sectionId) {
23
- return jsonArrayFrom(dbDebats
24
+ return jsonArrayFrom(dbSenat
25
+ .withSchema("debats")
24
26
  .selectFrom("intpjl")
25
27
  .where("intpjl.secdiscle", "=", sectionId)
26
28
  .select(({ ref, val }) => [
@@ -33,7 +35,8 @@ function interventionsLegislatives(sectionId) {
33
35
  .orderBy("intpjl.intordid asc"));
34
36
  }
35
37
  function sectionsNonLegislatives(dateSeance) {
36
- return jsonArrayFrom(dbDebats
38
+ return jsonArrayFrom(dbSenat
39
+ .withSchema("debats")
37
40
  .selectFrom("secdivers")
38
41
  .leftJoin("typsec", "secdivers.typseccod", "typsec.typseccod")
39
42
  .where("secdivers.datsea", "=", dateSeance)
@@ -46,7 +49,8 @@ function sectionsNonLegislatives(dateSeance) {
46
49
  ]));
47
50
  }
48
51
  function interventionsNonLegislatives(sectionId) {
49
- return jsonArrayFrom(dbDebats
52
+ return jsonArrayFrom(dbSenat
53
+ .withSchema("debats")
50
54
  .selectFrom("intdivers")
51
55
  .where("intdivers.intdiverscle", "=", sectionId)
52
56
  .select(({ ref, val }) => [
@@ -59,12 +63,14 @@ function interventionsNonLegislatives(sectionId) {
59
63
  .orderBy("intdivers.intdiversordid asc"));
60
64
  }
61
65
  function lecturesAssemblee(dateSeance) {
62
- return jsonArrayFrom(dbDebats
66
+ return jsonArrayFrom(dbSenat
67
+ .withSchema("debats")
63
68
  .selectFrom("lecassdeb")
64
69
  .where("lecassdeb.datsea", "=", dateSeance)
65
70
  .select("lecassdeb.lecassidt as id"));
66
71
  }
67
- const findAllQuery = dbDebats
72
+ const findAllQuery = dbSenat
73
+ .withSchema("debats")
68
74
  .selectFrom("debats")
69
75
  .select(({ ref, val }) => [
70
76
  toDateString(ref("debats.datsea"), val(ID_DATE_FORMAT)).as("id"),