generated from betagouv/template-nextjs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
4,900 additions
and
3,960 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "report" ADD COLUMN "applicantEmail" TEXT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
CREATE TABLE clause_v2 ( | ||
id text NOT NULL PRIMARY KEY | ||
,key text NOT NULL | ||
,value text NOT NULL | ||
,position int | ||
,udap_id text | ||
,text text NOT NULL | ||
); | ||
|
||
ALTER TABLE clause_v2 ENABLE ELECTRIC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE clause ADD COLUMN "hidden" BOOLEAN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE pdf_snapshot ( | ||
id TEXT PRIMARY KEY, | ||
report_id TEXT, | ||
html TEXT, | ||
report TEXT, | ||
user_id TEXT | ||
); | ||
|
||
ALTER TABLE pdf_snapshot ENABLE ELECTRIC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { db } from "./db/db"; | ||
import { v4 } from "uuid"; | ||
import { groupBy } from "pastable"; | ||
|
||
export const initClauseV2 = async () => { | ||
const nbClausesV2 = await db.clause_v2.count(); | ||
if (nbClausesV2 > 0) return; | ||
|
||
const clauses = await db.clause.findMany(); | ||
|
||
const grouped = groupBy(clauses, (clause) => `${clause.udap_id}-${clause.key}`); | ||
|
||
for (const clausesToAdd of Object.values(grouped)) { | ||
for (let i = 0; i < clausesToAdd.length; i++) { | ||
const clause = clausesToAdd[i]!; | ||
await db.clause_v2.create({ | ||
data: { | ||
id: v4(), | ||
key: clause.key, | ||
text: clause.text, | ||
value: clause.value, | ||
position: i, | ||
udap_id: clause.udap_id, | ||
}, | ||
}); | ||
} | ||
} | ||
|
||
return "done"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.