Skip to content

Commit

Permalink
refactor(insee): extract insee connector to individual pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 18, 2024
1 parent 7e68f48 commit 4020044
Show file tree
Hide file tree
Showing 32 changed files with 453 additions and 184 deletions.
8 changes: 4 additions & 4 deletions migrations/1545154190802_create-users-table.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exports.shorthands = undefined;

exports.up = async (pgm) => {
await pgm.db.query(`
await pgm.db.query(`
CREATE TABLE users (
id serial NOT NULL,
email character varying DEFAULT ''::character varying NOT NULL,
Expand All @@ -21,16 +21,16 @@ CREATE TABLE users (
type character varying
);`);

await pgm.db.query(`
await pgm.db.query(`
ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
`);

await pgm.db.query(`
CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email);
CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email);
`);

await pgm.db.query(`
await pgm.db.query(`
CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);
`);

Expand Down
2 changes: 2 additions & 0 deletions migrations/1623752868625_add-moderation-table.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ exports.shorthands = undefined;
exports.up = async (pgm) => {
await pgm.db.query(`
CREATE TYPE moderation_type AS ENUM('organization_join_block');
`);
await pgm.db.query(`
CREATE TABLE moderations (
id serial,
user_id int NOT NULL,
Expand Down
2 changes: 2 additions & 0 deletions migrations/1633705667117_add-new-moderation-type.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ exports.up = async (pgm) => {
await pgm.db.query(`
ALTER TABLE moderations
ALTER COLUMN type TYPE character varying;
`);
await pgm.db.query(`
DROP TYPE moderation_type;
`);
};
Expand Down
3 changes: 3 additions & 0 deletions migrations/1702600151114_add-webauthn.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ exports.up = async (pgm) => {
REFERENCES users (id)
ON DELETE CASCADE
);
`);

await pgm.db.query(`
CREATE UNIQUE INDEX index_authenticators_on_credential_id ON authenticators USING btree (credential_id);
`);

Expand Down
74 changes: 66 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:js": "tsc --watch --preserveWatchOutput",
"watch:node": "tsx --watch src/index.ts",
"watch:workspaces:core": "npm run dev --if-present --workspace=@gouvfr-lasuite/proconnect.core",
"watch:workspaces:email": "npm run dev --if-present --workspace=@gouvfr-lasuite/proconnect.email"
"watch:workspaces:email": "npm run dev --if-present --workspace=@gouvfr-lasuite/proconnect.email",
"watch:workspaces:insee": "npm run dev --if-present --workspace=@gouvfr-lasuite/proconnect.insee",
"watch:workspaces:identite": "npm run dev --if-present --workspace=@gouvfr-lasuite/proconnect.identite"
},
"prettier": {
"plugins": [
Expand All @@ -51,6 +53,8 @@
"@gouvfr-lasuite/crisp": "https://github.com/douglasduteil/crisp/releases/download/v1.6.1/douglasduteil-crisp-1.6.1.tgz",
"@gouvfr-lasuite/proconnect.core": "workspace:*",
"@gouvfr-lasuite/proconnect.email": "workspace:*",
"@gouvfr-lasuite/proconnect.identite": "workspace:*",
"@gouvfr-lasuite/proconnect.insee": "workspace:*",
"@gouvfr/dsfr": "^1.12.1",
"@kitajs/html": "^4.2.4",
"@kitajs/ts-html-plugin": "^4.1.0",
Expand Down
Empty file.
63 changes: 0 additions & 63 deletions packages/core/src/connectors/insee/get-access-token.test.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/core/src/connectors/insee/get-access-token.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/core/src/connectors/insee/index.ts

This file was deleted.

64 changes: 64 additions & 0 deletions packages/identite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@gouvfr-lasuite/proconnect.identite",
"version": "0.2.0",
"homepage": "https://github.com/numerique-gouv/moncomptepro/tree/master/packages/identite#readme",
"bugs": "https://github.com/numerique-gouv/moncomptepro/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/numerique-gouv/moncomptepro.git",
"directory": "packages/identite"
},
"license": "MIT",
"sideEffects": false,
"type": "module",
"imports": {
"#src/*": {
"types": "./src/*",
"default": "./dist/*"
}
},
"exports": {
"./*": {
"require": {
"types": "./dist/*/index.d.ts",
"default": "./dist/*/index.js"
},
"import": {
"types": "./dist/*/index.d.ts",
"default": "./dist/*/index.js"
},
"types": "./dist/*/index.d.ts",
"default": "./dist/*/index.js"
}
},
"scripts": {
"build": "tsc --project tsconfig.lib.json",
"check": "npm run build -- --noEmit",
"dev": "npm run build -- --watch --preserveWatchOutput",
"test": "mocha"
},
"mocha": {
"reporter": "spec",
"require": [
"tsx"
],
"spec": "src/**/*.test.ts"
},
"dependencies": {},
"devDependencies": {
"@electric-sql/pglite": "^0.2.15",
"@gouvfr-lasuite/proconnect.core": "^0.2.0",
"@tsconfig/node22": "^22.0.0",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.2",
"chai": "^5.1.2",
"mocha": "^11.0.1",
"node-pg-migrate": "^7.6.1",
"pg": "^8.13.0",
"tsx": "^4.19.2"
},
"publishConfig": {
"access": "public",
"provenance": true
}
}
3 changes: 3 additions & 0 deletions packages/identite/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//

export * from "./user.js";
Loading

0 comments on commit 4020044

Please sign in to comment.