@proconnect-gouv/proconnect.identite 10.0.2 → 10.2.0
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/CHANGELOG.md +18 -0
- package/dist/connectors/index.d.ts +87 -45
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +31 -53
- package/dist/managers/organization/adapters/api_entreprise.d.ts +3 -3
- package/dist/managers/organization/adapters/api_entreprise.d.ts.map +1 -1
- package/dist/managers/organization/adapters/api_entreprise.js +30 -27
- package/dist/managers/organization/adapters/index.d.ts +1 -0
- package/dist/managers/organization/adapters/index.d.ts.map +1 -1
- package/dist/managers/organization/adapters/index.js +1 -0
- package/dist/managers/organization/adapters/rne.d.ts +4 -0
- package/dist/managers/organization/adapters/rne.d.ts.map +1 -0
- package/dist/managers/organization/adapters/rne.js +7 -0
- package/dist/managers/organization/get-organization-info.d.ts +2 -1
- package/dist/managers/organization/get-organization-info.d.ts.map +1 -1
- package/dist/managers/organization/get-organization-info.js +27 -7
- package/dist/managers/user/assign-user-verification-type-to-domain.d.ts.map +1 -1
- package/dist/managers/user/assign-user-verification-type-to-domain.js +3 -3
- package/dist/repositories/authenticator/find-authenticators-by-user-id.d.ts +3 -0
- package/dist/repositories/authenticator/find-authenticators-by-user-id.d.ts.map +1 -0
- package/dist/repositories/authenticator/{get-authenticators-by-user-id.js → find-authenticators-by-user-id.js} +2 -2
- package/dist/repositories/authenticator/index.d.ts +1 -1
- package/dist/repositories/authenticator/index.d.ts.map +1 -1
- package/dist/repositories/authenticator/index.js +1 -1
- package/dist/repositories/authenticator/update-authenticator.d.ts +1 -2
- package/dist/repositories/authenticator/update-authenticator.d.ts.map +1 -1
- package/dist/repositories/franceconnect_userinfo/delete-franceconnect-userinfo.d.ts +4 -0
- package/dist/repositories/franceconnect_userinfo/delete-franceconnect-userinfo.d.ts.map +1 -0
- package/dist/repositories/{user → franceconnect_userinfo}/delete-franceconnect-userinfo.js +2 -2
- package/dist/repositories/{user/get-franceconnect-user-info.d.ts → franceconnect_userinfo/find-franceconnect-userinfo.d.ts} +2 -3
- package/dist/repositories/franceconnect_userinfo/find-franceconnect-userinfo.d.ts.map +1 -0
- package/dist/repositories/{user/get-franceconnect-user-info.js → franceconnect_userinfo/find-franceconnect-userinfo.js} +2 -2
- package/dist/repositories/franceconnect_userinfo/index.d.ts +4 -0
- package/dist/repositories/franceconnect_userinfo/index.d.ts.map +1 -0
- package/dist/repositories/franceconnect_userinfo/index.js +3 -0
- package/dist/repositories/franceconnect_userinfo/upsert-franceconnect-userinfo.d.ts.map +1 -0
- package/dist/repositories/official-contact-email-verification/delete-official-contact-email-verification.d.ts +3 -0
- package/dist/repositories/official-contact-email-verification/delete-official-contact-email-verification.d.ts.map +1 -0
- package/dist/repositories/official-contact-email-verification/delete-official-contact-email-verification.js +12 -0
- package/dist/repositories/official-contact-email-verification/find-official-contact-email-verification.d.ts +10 -0
- package/dist/repositories/official-contact-email-verification/find-official-contact-email-verification.d.ts.map +1 -0
- package/dist/repositories/official-contact-email-verification/find-official-contact-email-verification.js +13 -0
- package/dist/repositories/official-contact-email-verification/index.d.ts +4 -0
- package/dist/repositories/official-contact-email-verification/index.d.ts.map +1 -0
- package/dist/repositories/official-contact-email-verification/index.js +4 -0
- package/dist/repositories/official-contact-email-verification/upsert-official-contact-email-verification.d.ts +10 -0
- package/dist/repositories/official-contact-email-verification/upsert-official-contact-email-verification.d.ts.map +1 -0
- package/dist/repositories/official-contact-email-verification/upsert-official-contact-email-verification.js +19 -0
- package/dist/repositories/organization/find-by-user-id.d.ts +0 -3
- package/dist/repositories/organization/find-by-user-id.d.ts.map +1 -1
- package/dist/repositories/organization/find-by-user-id.js +10 -14
- package/dist/repositories/organization/find-organization-by-id.d.ts +4 -0
- package/dist/repositories/organization/find-organization-by-id.d.ts.map +1 -0
- package/dist/repositories/organization/{find-by-id.js → find-organization-by-id.js} +2 -2
- package/dist/repositories/organization/{get-users-by-organization.d.ts → find-users-by-organization.d.ts} +2 -6
- package/dist/repositories/organization/find-users-by-organization.d.ts.map +1 -0
- package/dist/repositories/organization/find-users-by-organization.js +19 -0
- package/dist/repositories/organization/get-organization-by-id.d.ts +3 -0
- package/dist/repositories/organization/get-organization-by-id.d.ts.map +1 -0
- package/dist/repositories/organization/get-organization-by-id.js +15 -0
- package/dist/repositories/organization/index.d.ts +3 -5
- package/dist/repositories/organization/index.d.ts.map +1 -1
- package/dist/repositories/organization/index.js +3 -5
- package/dist/repositories/organization/upsert.d.ts.map +1 -1
- package/dist/repositories/organization/upsert.js +8 -3
- package/dist/repositories/user/index.d.ts +0 -3
- package/dist/repositories/user/index.d.ts.map +1 -1
- package/dist/repositories/user/index.js +0 -3
- package/dist/repositories/{organization/link-user-to-organization.d.ts → user_organisation/create-user-organization.d.ts} +2 -6
- package/dist/repositories/user_organisation/create-user-organization.d.ts.map +1 -0
- package/dist/repositories/{organization/link-user-to-organization.js → user_organisation/create-user-organization.js} +2 -3
- package/dist/repositories/user_organisation/delete-user-organization.d.ts +3 -0
- package/dist/repositories/user_organisation/delete-user-organization.d.ts.map +1 -0
- package/dist/repositories/{organization → user_organisation}/delete-user-organization.js +4 -2
- package/dist/repositories/{organization/get-user-organization-link.d.ts → user_organisation/find-user-organization.d.ts} +3 -6
- package/dist/repositories/user_organisation/find-user-organization.d.ts.map +1 -0
- package/dist/repositories/user_organisation/find-user-organization.js +20 -0
- package/dist/repositories/user_organisation/index.d.ts +5 -0
- package/dist/repositories/user_organisation/index.d.ts.map +1 -0
- package/dist/repositories/user_organisation/index.js +4 -0
- package/dist/repositories/{user/update-user-organization-link.d.ts → user_organisation/update-user-organization.d.ts} +3 -7
- package/dist/repositories/user_organisation/update-user-organization.d.ts.map +1 -0
- package/dist/repositories/{user/update-user-organization-link.js → user_organisation/update-user-organization.js} +2 -2
- package/dist/types/authenticator.d.ts +3 -1
- package/dist/types/authenticator.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/official-contact-email-verification.d.ts +23 -0
- package/dist/types/official-contact-email-verification.d.ts.map +1 -0
- package/dist/types/official-contact-email-verification.js +15 -0
- package/dist/types/organization-info.d.ts +10 -3
- package/dist/types/organization-info.d.ts.map +1 -1
- package/dist/types/organization-info.js +5 -1
- package/dist/types/organization.d.ts +2 -1
- package/dist/types/organization.d.ts.map +1 -1
- package/dist/types/user-organization-link.d.ts +5 -7
- package/dist/types/user-organization-link.d.ts.map +1 -1
- package/dist/types/user-organization-link.js +4 -6
- package/package.json +5 -5
- package/src/connectors/index.ts +83 -53
- package/src/managers/organization/adapters/api_entreprise.test.ts +6 -6
- package/src/managers/organization/adapters/api_entreprise.test.ts.snapshot +4 -4
- package/src/managers/organization/adapters/api_entreprise.ts +41 -31
- package/src/managers/organization/adapters/index.ts +1 -0
- package/src/managers/organization/adapters/rne.ts +14 -0
- package/src/managers/organization/get-organization-info.test.ts +66 -19
- package/src/managers/organization/get-organization-info.test.ts.snapshot +31 -3
- package/src/managers/organization/get-organization-info.ts +44 -13
- package/src/managers/organization/mark-domain-as-verified.test.ts +2 -3
- package/src/managers/user/assign-user-verification-type-to-domain.test.ts +7 -8
- package/src/managers/user/assign-user-verification-type-to-domain.ts +8 -5
- package/src/repositories/authenticator/{get-authenticators-by-user-id.test.ts → find-authenticators-by-user-id.test.ts} +5 -5
- package/src/repositories/authenticator/{get-authenticators-by-user-id.ts → find-authenticators-by-user-id.ts} +2 -2
- package/src/repositories/authenticator/index.ts +1 -1
- package/src/repositories/authenticator/update-authenticator.ts +1 -1
- package/src/repositories/{user → franceconnect_userinfo}/delete-franceconnect-userinfo.test.ts +7 -7
- package/src/repositories/franceconnect_userinfo/delete-franceconnect-userinfo.ts +21 -0
- package/src/repositories/{user/get-franceconnect-user-info.test.ts → franceconnect_userinfo/find-franceconnect-userinfo.test.ts} +5 -5
- package/src/repositories/{user/get-franceconnect-user-info.ts → franceconnect_userinfo/find-franceconnect-userinfo.ts} +2 -6
- package/src/repositories/franceconnect_userinfo/index.ts +3 -0
- package/src/repositories/official-contact-email-verification/delete-official-contact-email-verification.test.ts +106 -0
- package/src/repositories/official-contact-email-verification/delete-official-contact-email-verification.ts +29 -0
- package/src/repositories/official-contact-email-verification/find-official-contact-email-verification.test.ts +136 -0
- package/src/repositories/official-contact-email-verification/find-official-contact-email-verification.ts +31 -0
- package/src/repositories/official-contact-email-verification/index.ts +5 -0
- package/src/repositories/official-contact-email-verification/upsert-official-contact-email-verification.test.ts +170 -0
- package/src/repositories/official-contact-email-verification/upsert-official-contact-email-verification.ts +38 -0
- package/src/repositories/organization/find-by-user-id.test.ts +5 -6
- package/src/repositories/organization/find-by-user-id.test.ts.snapshot +6 -12
- package/src/repositories/organization/find-by-user-id.ts +10 -14
- package/src/repositories/organization/{find-by-id.test.ts → find-organization-by-id.test.ts} +5 -4
- package/src/repositories/organization/{find-by-id.ts → find-organization-by-id.ts} +3 -3
- package/src/repositories/organization/{get-users-by-organization.test.ts → find-users-by-organization.test.ts} +9 -8
- package/src/repositories/organization/{get-users-by-organization.test.ts.snapshot → find-users-by-organization.test.ts.snapshot} +2 -5
- package/src/repositories/organization/find-users-by-organization.ts +38 -0
- package/src/repositories/organization/get-organization-by-id.test.ts +37 -0
- package/src/repositories/organization/get-organization-by-id.ts +19 -0
- package/src/repositories/organization/index.ts +3 -5
- package/src/repositories/organization/upsert.ts +9 -1
- package/src/repositories/organization/upset.test.ts +2 -0
- package/src/repositories/user/index.ts +0 -3
- package/src/repositories/{organization/link-user-to-organization.test.ts → user_organisation/create-user-organization.test.ts} +2 -2
- package/src/repositories/{organization/link-user-to-organization.test.ts.snapshot → user_organisation/create-user-organization.test.ts.snapshot} +0 -6
- package/src/repositories/{organization/link-user-to-organization.ts → user_organisation/create-user-organization.ts} +1 -7
- package/src/repositories/{organization → user_organisation}/delete-user-organization.ts +6 -7
- package/src/repositories/{organization/get-user-organization-link.test.ts → user_organisation/find-user-organization.test.ts} +5 -5
- package/src/repositories/user_organisation/find-user-organization.ts +35 -0
- package/src/repositories/user_organisation/index.ts +4 -0
- package/src/repositories/{user/update-user-organization-link.test.ts → user_organisation/update-user-organization.test.ts} +10 -8
- package/src/repositories/{user/update-user-organization-link.ts → user_organisation/update-user-organization.ts} +9 -9
- package/src/services/organization/compute-service-public-info.test.ts +10 -0
- package/src/types/authenticator.ts +10 -5
- package/src/types/index.ts +1 -0
- package/src/types/official-contact-email-verification.ts +32 -0
- package/src/types/organization-info.ts +14 -3
- package/src/types/organization.ts +19 -1
- package/src/types/user-organization-link.ts +9 -8
- package/dist/repositories/authenticator/get-authenticators-by-user-id.d.ts +0 -3
- package/dist/repositories/authenticator/get-authenticators-by-user-id.d.ts.map +0 -1
- package/dist/repositories/organization/delete-user-organization.d.ts +0 -6
- package/dist/repositories/organization/delete-user-organization.d.ts.map +0 -1
- package/dist/repositories/organization/find-by-id.d.ts +0 -4
- package/dist/repositories/organization/find-by-id.d.ts.map +0 -1
- package/dist/repositories/organization/get-user-organization-link.d.ts.map +0 -1
- package/dist/repositories/organization/get-user-organization-link.js +0 -23
- package/dist/repositories/organization/get-users-by-organization.d.ts.map +0 -1
- package/dist/repositories/organization/get-users-by-organization.js +0 -23
- package/dist/repositories/organization/link-user-to-organization.d.ts.map +0 -1
- package/dist/repositories/user/delete-franceconnect-userinfo.d.ts +0 -4
- package/dist/repositories/user/delete-franceconnect-userinfo.d.ts.map +0 -1
- package/dist/repositories/user/get-franceconnect-user-info.d.ts.map +0 -1
- package/dist/repositories/user/update-user-organization-link.d.ts.map +0 -1
- package/dist/repositories/user/upsert-franceconnect-userinfo.d.ts.map +0 -1
- package/src/repositories/organization/get-user-organization-link.ts +0 -34
- package/src/repositories/organization/get-users-by-organization.ts +0 -46
- package/src/repositories/user/delete-franceconnect-userinfo.ts +0 -21
- package/tsconfig.lib.tsbuildinfo +0 -1
- /package/dist/repositories/{user → franceconnect_userinfo}/upsert-franceconnect-userinfo.d.ts +0 -0
- /package/dist/repositories/{user → franceconnect_userinfo}/upsert-franceconnect-userinfo.js +0 -0
- /package/src/repositories/{user → franceconnect_userinfo}/upsert-franceconnect-userinfo.test.ts +0 -0
- /package/src/repositories/{user → franceconnect_userinfo}/upsert-franceconnect-userinfo.ts +0 -0
- /package/src/repositories/{organization → user_organisation}/delete-user-organization.test.ts +0 -0
|
@@ -4,13 +4,13 @@ import { getEmailDomain } from "@proconnect-gouv/proconnect.core/services/email"
|
|
|
4
4
|
//
|
|
5
5
|
export function assignUserVerificationTypeToDomainFactory({ repository: { organizations, users_organizations }, }) {
|
|
6
6
|
return async function assignUserVerificationTypeToDomain(organization_id, domain) {
|
|
7
|
-
const usersInOrganization = await organizations.
|
|
8
|
-
await Promise.all(usersInOrganization.map(({ id, email, verification_type: link_verification_type }) => {
|
|
7
|
+
const usersInOrganization = await organizations.findUsers(organization_id);
|
|
8
|
+
await Promise.all(usersInOrganization.map(({ id: user_id, email, verification_type: link_verification_type }) => {
|
|
9
9
|
const userDomain = getEmailDomain(email);
|
|
10
10
|
if (userDomain === domain &&
|
|
11
11
|
(UnverifiedLinkEnum.safeParse(link_verification_type).success ||
|
|
12
12
|
SuperWeakLinkEnum.safeParse(link_verification_type).success)) {
|
|
13
|
-
return users_organizations.update(organization_id,
|
|
13
|
+
return users_organizations.update({ organization_id, user_id }, {
|
|
14
14
|
verification_type: LinkEnum.enum.domain,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-authenticators-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/find-authenticators-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKjE,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,SAAS,MAAM,8BAYjE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//
|
|
2
2
|
import {} from "pg";
|
|
3
3
|
//
|
|
4
|
-
export function
|
|
5
|
-
return async function
|
|
4
|
+
export function findAuthenticatorsByUserIdFactory({ pg }) {
|
|
5
|
+
return async function findAuthenticatorsByUserId(user_id) {
|
|
6
6
|
const { rows } = await pg.query(`
|
|
7
7
|
SELECT *
|
|
8
8
|
FROM authenticators
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./create-authenticator.js";
|
|
2
2
|
export * from "./delete-authenticator.js";
|
|
3
3
|
export * from "./find-authenticator.js";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./find-authenticators-by-user-id.js";
|
|
5
5
|
export * from "./update-authenticator.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
export * from "./create-authenticator.js";
|
|
3
3
|
export * from "./delete-authenticator.js";
|
|
4
4
|
export * from "./find-authenticator.js";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./find-authenticators-by-user-id.js";
|
|
6
6
|
export * from "./update-authenticator.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Authenticator, BaseAuthenticator, DatabaseContext } from "#src/types";
|
|
2
|
-
import type { Base64URLString } from "@simplewebauthn/server";
|
|
1
|
+
import type { Authenticator, Base64URLString, BaseAuthenticator, DatabaseContext } from "#src/types";
|
|
3
2
|
export declare function updateAuthenticatorFactory({ pg }: DatabaseContext): (credential_id: Base64URLString, { counter, last_used_at, usage_count }: Partial<BaseAuthenticator>) => Promise<Authenticator>;
|
|
4
3
|
//# sourceMappingURL=update-authenticator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-authenticator.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/update-authenticator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"update-authenticator.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/update-authenticator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAE9D,eAAe,eAAe,EAC9B,wCAAwC,OAAO,CAAC,iBAAiB,CAAC,4BAarE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DatabaseContext } from "#src/types";
|
|
2
|
+
export declare function deleteFranceconnectUserinfoFactory({ pg }: DatabaseContext): (user_id: number) => Promise<import("pg").QueryResult<any>>;
|
|
3
|
+
export type DeleteFranceconnectUserinfoHandler = ReturnType<typeof deleteFranceconnectUserinfoFactory>;
|
|
4
|
+
//# sourceMappingURL=delete-franceconnect-userinfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-franceconnect-userinfo.d.ts","sourceRoot":"","sources":["../../../src/repositories/franceconnect_userinfo/delete-franceconnect-userinfo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,wBAAgB,kCAAkC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,SAAS,MAAM,4CASlE;AAED,MAAM,MAAM,kCAAkC,GAAG,UAAU,CACzD,OAAO,kCAAkC,CAC1C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//
|
|
2
2
|
//
|
|
3
|
-
export function
|
|
4
|
-
return async function
|
|
3
|
+
export function deleteFranceconnectUserinfoFactory({ pg }) {
|
|
4
|
+
return async function deleteFranceconnectUserinfo(user_id) {
|
|
5
5
|
return pg.query(`
|
|
6
6
|
DELETE FROM franceconnect_userinfo
|
|
7
7
|
WHERE user_id = $1
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DatabaseContext } from "#src/types";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function findFranceconnectUserinfoFactory({ pg }: DatabaseContext): (user_id: number) => Promise<{
|
|
3
3
|
birthcountry: string;
|
|
4
4
|
birthdate: Date;
|
|
5
5
|
birthplace: string;
|
|
@@ -12,5 +12,4 @@ export declare function getFranceConnectUserInfoFactory({ pg }: DatabaseContext)
|
|
|
12
12
|
user_id: number;
|
|
13
13
|
preferred_username?: string | undefined;
|
|
14
14
|
} | undefined>;
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=get-franceconnect-user-info.d.ts.map
|
|
15
|
+
//# sourceMappingURL=find-franceconnect-userinfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-franceconnect-userinfo.d.ts","sourceRoot":"","sources":["../../../src/repositories/franceconnect_userinfo/find-franceconnect-userinfo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,YAAY,CAAC;AAKzE,wBAAgB,gCAAgC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,SAAS,MAAM;;;;;;;;;;;;eAYhE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//
|
|
2
2
|
import {} from "pg";
|
|
3
3
|
//
|
|
4
|
-
export function
|
|
5
|
-
return async function
|
|
4
|
+
export function findFranceconnectUserinfoFactory({ pg }) {
|
|
5
|
+
return async function findFranceconnectUserinfo(user_id) {
|
|
6
6
|
const { rows } = await pg.query(`
|
|
7
7
|
SELECT *
|
|
8
8
|
FROM franceconnect_userinfo
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/franceconnect_userinfo/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert-franceconnect-userinfo.d.ts","sourceRoot":"","sources":["../../../src/repositories/franceconnect_userinfo/upsert-franceconnect-userinfo.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIzE,wBAAgB,kCAAkC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtE,OAAO,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAC3C,OAAO,CAAC,qBAAqB,CAAC;;;;;;;;;;;;GA0BnC;AAED,MAAM,MAAM,iCAAiC,GAAG,UAAU,CACxD,OAAO,kCAAkC,CAC1C,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DatabaseContext, FindOfficialContactEmailVerification } from "#src/types";
|
|
2
|
+
export declare function deleteOfficialContactEmailVerificationFactory({ pg, }: DatabaseContext): ({ user_id, organization_id, }: FindOfficialContactEmailVerification) => Promise<boolean>;
|
|
3
|
+
//# sourceMappingURL=delete-official-contact-email-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-official-contact-email-verification.d.ts","sourceRoot":"","sources":["../../../src/repositories/official-contact-email-verification/delete-official-contact-email-verification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,oCAAoC,EACrC,MAAM,YAAY,CAAC;AAKpB,wBAAgB,6CAA6C,CAAC,EAC5D,EAAE,GACH,EAAE,eAAe,IAC6C,+BAG1D,oCAAoC,sBAYxC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
//
|
|
3
|
+
export function deleteOfficialContactEmailVerificationFactory({ pg, }) {
|
|
4
|
+
return async function deleteOfficialContactEmailVerification({ user_id, organization_id, }) {
|
|
5
|
+
const { rowCount, affectedRows } = (await pg.query(`
|
|
6
|
+
DELETE
|
|
7
|
+
FROM official_contact_email_verifications
|
|
8
|
+
WHERE user_id = $1
|
|
9
|
+
AND organization_id = $2`, [user_id, organization_id]));
|
|
10
|
+
return (affectedRows ?? rowCount ?? 0) > 0;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DatabaseContext, FindOfficialContactEmailVerification } from "#src/types";
|
|
2
|
+
export declare function findOfficialContactEmailVerificationFactory({ pg, }: DatabaseContext): ({ organization_id, user_id, }: FindOfficialContactEmailVerification) => Promise<{
|
|
3
|
+
organization_id: number;
|
|
4
|
+
sent_at: Date | null;
|
|
5
|
+
token: string | null;
|
|
6
|
+
user_id: number;
|
|
7
|
+
created_at: Date;
|
|
8
|
+
updated_at: Date;
|
|
9
|
+
} | undefined>;
|
|
10
|
+
//# sourceMappingURL=find-official-contact-email-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-official-contact-email-verification.d.ts","sourceRoot":"","sources":["../../../src/repositories/official-contact-email-verification/find-official-contact-email-verification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,oCAAoC,EAErC,MAAM,YAAY,CAAC;AAKpB,wBAAgB,2CAA2C,CAAC,EAC1D,EAAE,GACH,EAAE,eAAe,IAC2C,+BAGxD,oCAAoC;;;;;;;eAaxC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
import {} from "pg";
|
|
3
|
+
//
|
|
4
|
+
export function findOfficialContactEmailVerificationFactory({ pg, }) {
|
|
5
|
+
return async function findOfficialContactEmailVerification({ organization_id, user_id, }) {
|
|
6
|
+
const { rows } = await pg.query(`
|
|
7
|
+
SELECT *
|
|
8
|
+
FROM official_contact_email_verifications
|
|
9
|
+
WHERE organization_id = $1
|
|
10
|
+
AND user_id = $2;`, [organization_id, user_id]);
|
|
11
|
+
return rows.shift();
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/official-contact-email-verification/index.ts"],"names":[],"mappings":"AAEA,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iDAAiD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BaseOfficialContactEmailVerification, DatabaseContext } from "#src/types";
|
|
2
|
+
export declare function upsertOfficialContactEmailVerificationFactory({ pg, }: DatabaseContext): ({ organization_id, user_id, token, sent_at, }: BaseOfficialContactEmailVerification) => Promise<{
|
|
3
|
+
organization_id: number;
|
|
4
|
+
sent_at: Date | null;
|
|
5
|
+
token: string | null;
|
|
6
|
+
user_id: number;
|
|
7
|
+
created_at: Date;
|
|
8
|
+
updated_at: Date;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=upsert-official-contact-email-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert-official-contact-email-verification.d.ts","sourceRoot":"","sources":["../../../src/repositories/official-contact-email-verification/upsert-official-contact-email-verification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oCAAoC,EACpC,eAAe,EAEhB,MAAM,YAAY,CAAC;AAIpB,wBAAgB,6CAA6C,CAAC,EAC5D,EAAE,GACH,EAAE,eAAe,IAC6C,+CAK1D,oCAAoC;;;;;;;GAmBxC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
//
|
|
3
|
+
export function upsertOfficialContactEmailVerificationFactory({ pg, }) {
|
|
4
|
+
return async function upsertOfficialContactEmailVerification({ organization_id, user_id, token, sent_at, }) {
|
|
5
|
+
const { rows } = await pg.query(`
|
|
6
|
+
INSERT INTO official_contact_email_verifications(created_at, updated_at, organization_id, user_id, token, sent_at)
|
|
7
|
+
VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, $1, $2, $3, $4)
|
|
8
|
+
ON CONFLICT (organization_id, user_id)
|
|
9
|
+
DO UPDATE
|
|
10
|
+
SET organization_id = EXCLUDED.organization_id,
|
|
11
|
+
user_id = EXCLUDED.user_id,
|
|
12
|
+
token = EXCLUDED.token,
|
|
13
|
+
sent_at = EXCLUDED.sent_at,
|
|
14
|
+
updated_at = CURRENT_TIMESTAMP
|
|
15
|
+
RETURNING *
|
|
16
|
+
`, [organization_id, user_id, token, sent_at]);
|
|
17
|
+
return rows.shift();
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -4,9 +4,6 @@ export declare function findByUserIdFactory({ pg }: DatabaseContext): (userId: n
|
|
|
4
4
|
verification_type: "domain" | "organization_dirigeant" | "code_sent_to_official_contact_email" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "ordre_professionnel_domain" | "proof_received" | "verified_by_coop_mediation_numerique" | "bypassed" | "domain_not_verified_yet" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "no_verification_means_for_small_organization";
|
|
5
5
|
verified_at: Date | null;
|
|
6
6
|
has_been_greeted: boolean;
|
|
7
|
-
needs_official_contact_email_verification: boolean;
|
|
8
|
-
official_contact_email_verification_token: string | null;
|
|
9
|
-
official_contact_email_verification_sent_at: Date | null;
|
|
10
7
|
})[]>;
|
|
11
8
|
export type FindByUserIdHandler = ReturnType<typeof findByUserIdFactory>;
|
|
12
9
|
//# sourceMappingURL=find-by-user-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAC;AAKpB,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,QAAQ,MAAM
|
|
1
|
+
{"version":3,"file":"find-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAC;AAKpB,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,QAAQ,MAAM;;;;;MAmBlD;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -3,20 +3,16 @@
|
|
|
3
3
|
export function findByUserIdFactory({ pg }) {
|
|
4
4
|
return async function findByUserId(userId) {
|
|
5
5
|
const { rows } = await pg.query(`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
uo.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
INNER JOIN users_organizations uo ON uo.organization_id = o.id
|
|
17
|
-
WHERE uo.user_id = $1
|
|
18
|
-
ORDER BY o.created_at
|
|
19
|
-
`, [userId]);
|
|
6
|
+
SELECT o.*,
|
|
7
|
+
uo.is_external,
|
|
8
|
+
uo.verification_type,
|
|
9
|
+
uo.verified_at,
|
|
10
|
+
uo.has_been_greeted
|
|
11
|
+
FROM organizations o
|
|
12
|
+
INNER JOIN users_organizations uo ON uo.organization_id = o.id
|
|
13
|
+
WHERE uo.user_id = $1
|
|
14
|
+
ORDER BY o.created_at
|
|
15
|
+
`, [userId]);
|
|
20
16
|
return rows;
|
|
21
17
|
};
|
|
22
18
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DatabaseContext, Organization } from "#src/types";
|
|
2
|
+
export declare function findOrganizationByIdFactory({ pg }: DatabaseContext): (id: number) => Promise<Organization | undefined>;
|
|
3
|
+
export type FindByIdHandler = ReturnType<typeof findOrganizationByIdFactory>;
|
|
4
|
+
//# sourceMappingURL=find-organization-by-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-organization-by-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-organization-by-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAKhE,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,IAAI,MAAM,uCAWtD;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//
|
|
2
2
|
//
|
|
3
|
-
export function
|
|
4
|
-
return async function
|
|
3
|
+
export function findOrganizationByIdFactory({ pg }) {
|
|
4
|
+
return async function findOrganizationById(id) {
|
|
5
5
|
const { rows } = await pg.query(`
|
|
6
6
|
SELECT *
|
|
7
7
|
FROM organizations
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { DatabaseContext, User } from "#src/types";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function findUsersByOrganizationFactory({ pg }: DatabaseContext): (organization_id: number, additionalWhereClause?: string, additionalParams?: any[]) => Promise<(User & {
|
|
3
3
|
is_external: boolean;
|
|
4
4
|
verification_type: "domain" | "organization_dirigeant" | "code_sent_to_official_contact_email" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "ordre_professionnel_domain" | "proof_received" | "verified_by_coop_mediation_numerique" | "bypassed" | "domain_not_verified_yet" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "no_verification_means_for_small_organization";
|
|
5
5
|
verified_at: Date | null;
|
|
6
6
|
has_been_greeted: boolean;
|
|
7
|
-
needs_official_contact_email_verification: boolean;
|
|
8
|
-
official_contact_email_verification_token: string | null;
|
|
9
|
-
official_contact_email_verification_sent_at: Date | null;
|
|
10
7
|
})[]>;
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=get-users-by-organization.d.ts.map
|
|
8
|
+
//# sourceMappingURL=find-users-by-organization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-users-by-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-users-by-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,IAAI,EACL,MAAM,YAAY,CAAC;AAKpB,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAElE,iBAAiB,MAAM,EACvB,wBAAuB,MAAW,EAClC,mBAAkB,GAAG,EAAO;;;;;MAsB/B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
//
|
|
3
|
+
export function findUsersByOrganizationFactory({ pg }) {
|
|
4
|
+
return async function findUsersByOrganization(organization_id, additionalWhereClause = "", additionalParams = []) {
|
|
5
|
+
const connection = pg;
|
|
6
|
+
const baseParams = [organization_id];
|
|
7
|
+
const { rows } = await connection.query(`
|
|
8
|
+
SELECT u.*,
|
|
9
|
+
uo.is_external,
|
|
10
|
+
uo.verification_type,
|
|
11
|
+
uo.verified_at,
|
|
12
|
+
uo.has_been_greeted
|
|
13
|
+
FROM users u
|
|
14
|
+
INNER JOIN users_organizations AS uo ON uo.user_id = u.id
|
|
15
|
+
WHERE uo.organization_id = $1
|
|
16
|
+
${additionalWhereClause}`, [...baseParams, ...additionalParams]);
|
|
17
|
+
return rows;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-organization-by-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/get-organization-by-id.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAMrE,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAGtB,IAAI,MAAM,KAAG,OAAO,CAAC,YAAY,CAAC,CAO7E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
import {} from "#src/types";
|
|
3
|
+
import { OrganizationNotFoundError } from "@proconnect-gouv/proconnect.identite/errors";
|
|
4
|
+
import { findOrganizationByIdFactory } from "./find-organization-by-id.js";
|
|
5
|
+
//
|
|
6
|
+
export function getOrganizationByIdFactory({ pg }) {
|
|
7
|
+
const findOrganizationById = findOrganizationByIdFactory({ pg });
|
|
8
|
+
return async function getOrganizationById(id) {
|
|
9
|
+
const organization = await findOrganizationById(id);
|
|
10
|
+
if (!organization) {
|
|
11
|
+
throw new OrganizationNotFoundError(`Organization ${id} not found`);
|
|
12
|
+
}
|
|
13
|
+
return organization;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
export * from "./delete-user-organization.js";
|
|
2
|
-
export * from "./find-by-id.js";
|
|
3
1
|
export * from "./find-by-siret.js";
|
|
4
2
|
export * from "./find-by-user-id.js";
|
|
5
3
|
export * from "./find-by-verified-email-domain.js";
|
|
4
|
+
export * from "./find-organization-by-id.js";
|
|
6
5
|
export * from "./find-pending-by-user-id.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./get-
|
|
9
|
-
export * from "./link-user-to-organization.js";
|
|
6
|
+
export * from "./find-users-by-organization.js";
|
|
7
|
+
export * from "./get-organization-by-id.js";
|
|
10
8
|
export * from "./upsert.js";
|
|
11
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
//
|
|
2
|
-
export * from "./delete-user-organization.js";
|
|
3
|
-
export * from "./find-by-id.js";
|
|
4
2
|
export * from "./find-by-siret.js";
|
|
5
3
|
export * from "./find-by-user-id.js";
|
|
6
4
|
export * from "./find-by-verified-email-domain.js";
|
|
5
|
+
export * from "./find-organization-by-id.js";
|
|
7
6
|
export * from "./find-pending-by-user-id.js";
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./get-
|
|
10
|
-
export * from "./link-user-to-organization.js";
|
|
7
|
+
export * from "./find-users-by-organization.js";
|
|
8
|
+
export * from "./get-organization-by-id.js";
|
|
11
9
|
export * from "./upsert.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,8BAG1B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,
|
|
1
|
+
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,8BAG1B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,2BAqIF;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
export function upsertFactory({ pg }) {
|
|
4
4
|
return async function upsert({ siret, organizationInfo, }) {
|
|
5
|
-
const { cached_libelle, cached_nom_complet, cached_enseigne, cached_tranche_effectifs, cached_tranche_effectifs_unite_legale, cached_libelle_tranche_effectif, cached_etat_administratif, cached_est_active, cached_statut_diffusion, cached_est_diffusible, cached_adresse, cached_code_postal, cached_code_officiel_geographique, cached_activite_principale, cached_libelle_activite_principale, cached_categorie_juridique, cached_libelle_categorie_juridique, cached_siege_social, } = toPartialOrganization(organizationInfo);
|
|
5
|
+
const { cached_libelle, cached_nom_complet, cached_enseigne, cached_tranche_effectifs, cached_tranche_effectifs_unite_legale, cached_libelle_tranche_effectif, cached_etat_administratif, cached_est_active, cached_statut_diffusion, cached_est_diffusible, cached_adresse, cached_code_postal, cached_code_officiel_geographique, cached_activite_principale, cached_libelle_activite_principale, cached_categorie_juridique, cached_libelle_categorie_juridique, cached_siege_social, cached_denomination_usuelle_etablissement_principal, } = toPartialOrganization(organizationInfo);
|
|
6
6
|
const { rows } = await pg.query(`
|
|
7
7
|
INSERT INTO organizations
|
|
8
8
|
(
|
|
@@ -25,12 +25,13 @@ export function upsertFactory({ pg }) {
|
|
|
25
25
|
cached_categorie_juridique,
|
|
26
26
|
cached_libelle_categorie_juridique,
|
|
27
27
|
cached_siege_social,
|
|
28
|
+
cached_denomination_usuelle_etablissement_principal,
|
|
28
29
|
organization_info_fetched_at,
|
|
29
30
|
updated_at,
|
|
30
31
|
created_at
|
|
31
32
|
)
|
|
32
33
|
VALUES
|
|
33
|
-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22)
|
|
34
|
+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23)
|
|
34
35
|
ON CONFLICT (siret)
|
|
35
36
|
DO UPDATE
|
|
36
37
|
SET (
|
|
@@ -53,6 +54,7 @@ export function upsertFactory({ pg }) {
|
|
|
53
54
|
cached_categorie_juridique,
|
|
54
55
|
cached_libelle_categorie_juridique,
|
|
55
56
|
cached_siege_social,
|
|
57
|
+
cached_denomination_usuelle_etablissement_principal,
|
|
56
58
|
organization_info_fetched_at,
|
|
57
59
|
updated_at
|
|
58
60
|
) = (
|
|
@@ -75,6 +77,7 @@ export function upsertFactory({ pg }) {
|
|
|
75
77
|
EXCLUDED.cached_categorie_juridique,
|
|
76
78
|
EXCLUDED.cached_libelle_categorie_juridique,
|
|
77
79
|
EXCLUDED.cached_siege_social,
|
|
80
|
+
EXCLUDED.cached_denomination_usuelle_etablissement_principal,
|
|
78
81
|
EXCLUDED.organization_info_fetched_at,
|
|
79
82
|
EXCLUDED.updated_at
|
|
80
83
|
)
|
|
@@ -99,6 +102,7 @@ export function upsertFactory({ pg }) {
|
|
|
99
102
|
cached_categorie_juridique,
|
|
100
103
|
cached_libelle_categorie_juridique,
|
|
101
104
|
cached_siege_social,
|
|
105
|
+
cached_denomination_usuelle_etablissement_principal,
|
|
102
106
|
new Date(),
|
|
103
107
|
new Date(),
|
|
104
108
|
new Date(),
|
|
@@ -108,7 +112,7 @@ export function upsertFactory({ pg }) {
|
|
|
108
112
|
}
|
|
109
113
|
//
|
|
110
114
|
function toPartialOrganization(organization_info) {
|
|
111
|
-
const { activitePrincipale: cached_activite_principale, adresse: cached_adresse, categorieJuridique: cached_categorie_juridique, codeOfficielGeographique: cached_code_officiel_geographique, codePostal: cached_code_postal, enseigne: cached_enseigne, estActive: cached_est_active, estDiffusible: cached_est_diffusible, etatAdministratif: cached_etat_administratif, libelle: cached_libelle, libelleActivitePrincipale: cached_libelle_activite_principale, libelleCategorieJuridique: cached_libelle_categorie_juridique, libelleTrancheEffectif: cached_libelle_tranche_effectif, nomComplet: cached_nom_complet, siegeSocial: cached_siege_social, siret, statutDiffusion: cached_statut_diffusion, trancheEffectifs: cached_tranche_effectifs, trancheEffectifsUniteLegale: cached_tranche_effectifs_unite_legale, } = organization_info;
|
|
115
|
+
const { activitePrincipale: cached_activite_principale, adresse: cached_adresse, categorieJuridique: cached_categorie_juridique, codeOfficielGeographique: cached_code_officiel_geographique, codePostal: cached_code_postal, denominationUsuelleEtablissementPrincipal: cached_denomination_usuelle_etablissement_principal, enseigne: cached_enseigne, estActive: cached_est_active, estDiffusible: cached_est_diffusible, etatAdministratif: cached_etat_administratif, libelle: cached_libelle, libelleActivitePrincipale: cached_libelle_activite_principale, libelleCategorieJuridique: cached_libelle_categorie_juridique, libelleTrancheEffectif: cached_libelle_tranche_effectif, nomComplet: cached_nom_complet, siegeSocial: cached_siege_social, siret, statutDiffusion: cached_statut_diffusion, trancheEffectifs: cached_tranche_effectifs, trancheEffectifsUniteLegale: cached_tranche_effectifs_unite_legale, } = organization_info;
|
|
112
116
|
return {
|
|
113
117
|
cached_activite_principale,
|
|
114
118
|
cached_adresse,
|
|
@@ -125,6 +129,7 @@ function toPartialOrganization(organization_info) {
|
|
|
125
129
|
cached_libelle,
|
|
126
130
|
cached_nom_complet,
|
|
127
131
|
cached_siege_social,
|
|
132
|
+
cached_denomination_usuelle_etablissement_principal,
|
|
128
133
|
cached_statut_diffusion,
|
|
129
134
|
cached_tranche_effectifs_unite_legale,
|
|
130
135
|
cached_tranche_effectifs,
|
|
@@ -5,8 +5,5 @@ export * from "./find-by-id.js";
|
|
|
5
5
|
export * from "./find-by-magic-link-token.js";
|
|
6
6
|
export * from "./find-by-reset-password-token.js";
|
|
7
7
|
export * from "./get-by-id.js";
|
|
8
|
-
export * from "./get-franceconnect-user-info.js";
|
|
9
|
-
export * from "./update-user-organization-link.js";
|
|
10
8
|
export * from "./update.js";
|
|
11
|
-
export * from "./upsert-franceconnect-userinfo.js";
|
|
12
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -6,7 +6,4 @@ export * from "./find-by-id.js";
|
|
|
6
6
|
export * from "./find-by-magic-link-token.js";
|
|
7
7
|
export * from "./find-by-reset-password-token.js";
|
|
8
8
|
export * from "./get-by-id.js";
|
|
9
|
-
export * from "./get-franceconnect-user-info.js";
|
|
10
|
-
export * from "./update-user-organization-link.js";
|
|
11
9
|
export * from "./update.js";
|
|
12
|
-
export * from "./upsert-franceconnect-userinfo.js";
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import type { DatabaseContext, InsertUserOrganizationLink } from "#src/types";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function createUserOrganizationFactory({ pg }: DatabaseContext): ({ is_external, organization_id, user_id, verification_type, }: InsertUserOrganizationLink) => Promise<{
|
|
3
3
|
is_external: boolean;
|
|
4
4
|
verification_type: "domain" | "organization_dirigeant" | "code_sent_to_official_contact_email" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "ordre_professionnel_domain" | "proof_received" | "verified_by_coop_mediation_numerique" | "bypassed" | "domain_not_verified_yet" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "no_verification_means_for_small_organization";
|
|
5
5
|
verified_at: Date | null;
|
|
6
6
|
has_been_greeted: boolean;
|
|
7
|
-
needs_official_contact_email_verification: boolean;
|
|
8
|
-
official_contact_email_verification_token: string | null;
|
|
9
|
-
official_contact_email_verification_sent_at: Date | null;
|
|
10
7
|
user_id: number;
|
|
11
8
|
organization_id: number;
|
|
12
9
|
created_at: Date;
|
|
13
10
|
updated_at: Date;
|
|
14
11
|
}>;
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=link-user-to-organization.d.ts.map
|
|
12
|
+
//# sourceMappingURL=create-user-organization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/create-user-organization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAE3B,MAAM,YAAY,CAAC;AAGpB,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,+DAK1C,0BAA0B;;;;;;;;;GAwB9B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { hashToPostgresParams } from "#src/services/postgres";
|
|
2
|
-
export function
|
|
3
|
-
return async function linkUserToOrganization({ is_external = false,
|
|
2
|
+
export function createUserOrganizationFactory({ pg }) {
|
|
3
|
+
return async function linkUserToOrganization({ is_external = false, organization_id, user_id, verification_type, }) {
|
|
4
4
|
const { paramsString, valuesString, values } = hashToPostgresParams({
|
|
5
5
|
created_at: new Date(),
|
|
6
6
|
is_external,
|
|
7
|
-
needs_official_contact_email_verification,
|
|
8
7
|
organization_id,
|
|
9
8
|
updated_at: new Date(),
|
|
10
9
|
user_id,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DatabaseContext, FindUserOrganizationLink } from "#src/types";
|
|
2
|
+
export declare function deleteUserOrganizationFactory({ pg }: DatabaseContext): ({ user_id, organization_id, }: FindUserOrganizationLink) => Promise<boolean>;
|
|
3
|
+
//# sourceMappingURL=delete-user-organization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/delete-user-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAK5E,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,+BAG1C,wBAAwB,sBAY5B"}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
export function deleteUserOrganizationFactory({ pg }) {
|
|
4
4
|
return async function deleteUserOrganization({ user_id, organization_id, }) {
|
|
5
5
|
const { rowCount, affectedRows } = (await pg.query(`
|
|
6
|
-
DELETE
|
|
7
|
-
|
|
6
|
+
DELETE
|
|
7
|
+
FROM users_organizations
|
|
8
|
+
WHERE user_id = $1
|
|
9
|
+
AND organization_id = $2`, [user_id, organization_id]));
|
|
8
10
|
return (affectedRows ?? rowCount ?? 0) > 0;
|
|
9
11
|
};
|
|
10
12
|
}
|