@proconnect-gouv/proconnect.identite 14.0.0 → 15.0.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 +8 -0
- package/dist/connectors/index.d.ts +0 -6
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +1 -2
- package/dist/repositories/organization/find-by-user-id.d.ts +0 -1
- package/dist/repositories/organization/find-by-user-id.d.ts.map +1 -1
- package/dist/repositories/organization/find-by-user-id.js +1 -2
- package/dist/repositories/organization/index.d.ts +0 -1
- package/dist/repositories/organization/index.d.ts.map +1 -1
- package/dist/repositories/organization/index.js +0 -1
- package/dist/repositories/user_organisation/find-user-organization.d.ts +0 -1
- package/dist/repositories/user_organisation/find-user-organization.d.ts.map +1 -1
- package/dist/repositories/user_organisation/find-user-organization.js +1 -2
- package/dist/repositories/user_organisation/get-user-organization.d.ts +0 -1
- package/dist/repositories/user_organisation/get-user-organization.d.ts.map +1 -1
- package/dist/types/user-organization-link.d.ts +0 -2
- package/dist/types/user-organization-link.d.ts.map +1 -1
- package/dist/types/user-organization-link.js +0 -1
- package/package.json +1 -1
- package/src/connectors/index.ts +0 -2
- package/src/repositories/organization/find-by-user-id.test.ts +5 -5
- package/src/repositories/organization/find-by-user-id.test.ts.snapshot +3 -6
- package/src/repositories/organization/find-by-user-id.ts +1 -2
- package/src/repositories/organization/index.ts +0 -1
- package/src/repositories/user_organisation/find-user-organization.ts +1 -2
- package/src/repositories/user_organisation/get-user-organization.test.ts +0 -1
- package/src/types/user-organization-link.ts +0 -1
- package/dist/repositories/organization/find-by-verified-email-domain.d.ts +0 -6
- package/dist/repositories/organization/find-by-verified-email-domain.d.ts.map +0 -1
- package/dist/repositories/organization/find-by-verified-email-domain.js +0 -21
- package/src/repositories/organization/find-by-verified-email-domain.test.ts +0 -46
- package/src/repositories/organization/find-by-verified-email-domain.ts +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.identite
|
|
2
2
|
|
|
3
|
+
## 15.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2396](https://github.com/proconnect-gouv/proconnect-identite/pull/2396) [`33604f3`](https://github.com/proconnect-gouv/proconnect-identite/commit/33604f32fb4393ec60e413f0b7bace8e94ac22fc) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findByVerifiedEmailDomainFactory` (`repositories/organization`) et l'entrée `organizations.findByVerifiedEmailDomain` de `connectors` : les suggestions d'organisation lisent maintenant la base en Drizzle depuis l'application.
|
|
8
|
+
|
|
9
|
+
- [#2394](https://github.com/proconnect-gouv/proconnect-identite/pull/2394) [`c1167a1`](https://github.com/proconnect-gouv/proconnect-identite/commit/c1167a150b16060ca704059e98040414bbf7a009) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire le champ `has_been_greeted` de `BaseUserOrganizationLink` et des requêtes de `repositories/organization` et `repositories/user_organisation` : la colonne n'existe plus.
|
|
10
|
+
|
|
3
11
|
## 14.0.0
|
|
4
12
|
|
|
5
13
|
### Major Changes
|
|
@@ -503,10 +503,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
503
503
|
is_external: boolean;
|
|
504
504
|
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";
|
|
505
505
|
verified_at: Date | null;
|
|
506
|
-
has_been_greeted: boolean;
|
|
507
|
-
})[]>;
|
|
508
|
-
findByVerifiedEmailDomain: (email_domain: string) => Promise<(import("../types/organization.js").Organization & {
|
|
509
|
-
member_count: number;
|
|
510
506
|
})[]>;
|
|
511
507
|
findPendingByUserId: (user_id: number) => Promise<(import("../types/organization.js").Organization & {
|
|
512
508
|
moderation_id: number;
|
|
@@ -530,7 +526,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
530
526
|
is_external: boolean;
|
|
531
527
|
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";
|
|
532
528
|
verified_at: Date | null;
|
|
533
|
-
has_been_greeted: boolean;
|
|
534
529
|
user_id: number;
|
|
535
530
|
organization_id: number;
|
|
536
531
|
created_at: Date;
|
|
@@ -540,7 +535,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
540
535
|
is_external: boolean;
|
|
541
536
|
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";
|
|
542
537
|
verified_at: Date | null;
|
|
543
|
-
has_been_greeted: boolean;
|
|
544
538
|
user_id: number;
|
|
545
539
|
organization_id: number;
|
|
546
540
|
created_at: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.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,CAAC;mDAC1B,CAAC;iDACZ,CAAC;2DAA4E,CAAC;+DAKnF,CAAC;yDAGJ,CAAD;iEAGwB,CAAC;6DAEP,CAAC;;;;;;wCAST,CAAC;kDAEI,CAAC;wDACA,CAAC;iDACP,CAAC;;;;;kCAIM,CAAC;;qBACkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCA/E/B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuIP;AACD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/connectors/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { findFranceconnectUserinfoFactory } from "#src/repositories/franceconnec
|
|
|
6
6
|
import { deleteModerationFactory, findModerationByIdFactory, findPendingModerationFactory, findRejectedModerationFactory, getModerationByIdFactory, reopenModerationFactory, } from "#src/repositories/moderation";
|
|
7
7
|
import { deleteOfficialContactEmailVerificationFactory, findOfficialContactEmailVerificationFactory, upsertOfficialContactEmailVerificationFactory, } from "#src/repositories/official-contact-email-verification";
|
|
8
8
|
import { findByClientIdFactory, upsertAuthorizationRequestFactory, } from "#src/repositories/oidc-client";
|
|
9
|
-
import { findBySiretFactory, findByUserIdFactory,
|
|
9
|
+
import { findBySiretFactory, findByUserIdFactory, findOrganizationByIdFactory, findPendingByUserIdFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
|
|
10
10
|
import { createRecoveryWordsFactory, deleteRecoveryWordsByUserIdFactory, findRecoveryWordsByUserIdFactory, } from "#src/repositories/recovery-words";
|
|
11
11
|
import { createUserFactory, findByEmailFactory, findByMagicLinkTokenFactory, findByResetPasswordTokenFactory, findByIdFactory as findUserByIdFactory, getByIdFactory, updateUserFactory, } from "#src/repositories/user";
|
|
12
12
|
import { findUserOrganizationFactory, getUserOrganizationFactory, } from "#src/repositories/user_organisation";
|
|
@@ -55,7 +55,6 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
55
55
|
findById: findOrganizationByIdFactory({ pg }),
|
|
56
56
|
findBySiret: findBySiretFactory({ pg }),
|
|
57
57
|
findByUserId: findByUserIdFactory({ pg }),
|
|
58
|
-
findByVerifiedEmailDomain: findByVerifiedEmailDomainFactory({ pg }),
|
|
59
58
|
findPendingByUserId: findPendingByUserIdFactory({ pg }),
|
|
60
59
|
getById: getOrganizationByIdFactory({ pg }),
|
|
61
60
|
upsert: upsertFactory({ pg }),
|
|
@@ -3,7 +3,6 @@ export declare function findByUserIdFactory({ pg }: DatabaseContext): (userId: n
|
|
|
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
|
-
has_been_greeted: boolean;
|
|
7
6
|
})[]>;
|
|
8
7
|
export type FindByUserIdHandler = ReturnType<typeof findByUserIdFactory>;
|
|
9
8
|
//# 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;;;;MAkBlD;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -6,8 +6,7 @@ export function findByUserIdFactory({ pg }) {
|
|
|
6
6
|
SELECT o.*,
|
|
7
7
|
uo.is_external,
|
|
8
8
|
uo.verification_type,
|
|
9
|
-
uo.verified_at
|
|
10
|
-
uo.has_been_greeted
|
|
9
|
+
uo.verified_at
|
|
11
10
|
FROM organizations o
|
|
12
11
|
INNER JOIN users_organizations uo ON uo.organization_id = o.id
|
|
13
12
|
WHERE uo.user_id = $1
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./find-by-siret.js";
|
|
2
2
|
export * from "./find-by-user-id.js";
|
|
3
|
-
export * from "./find-by-verified-email-domain.js";
|
|
4
3
|
export * from "./find-organization-by-id.js";
|
|
5
4
|
export * from "./find-pending-by-user-id.js";
|
|
6
5
|
export * from "./get-organization-by-id.js";
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
export * from "./find-by-siret.js";
|
|
3
3
|
export * from "./find-by-user-id.js";
|
|
4
|
-
export * from "./find-by-verified-email-domain.js";
|
|
5
4
|
export * from "./find-organization-by-id.js";
|
|
6
5
|
export * from "./find-pending-by-user-id.js";
|
|
7
6
|
export * from "./get-organization-by-id.js";
|
|
@@ -3,7 +3,6 @@ export declare function findUserOrganizationFactory({ pg }: DatabaseContext): ({
|
|
|
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
|
-
has_been_greeted: boolean;
|
|
7
6
|
user_id: number;
|
|
8
7
|
organization_id: number;
|
|
9
8
|
created_at: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/find-user-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EAEzB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,+BAGxC,wBAAwB
|
|
1
|
+
{"version":3,"file":"find-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/find-user-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EAEzB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,+BAGxC,wBAAwB;;;;;;;;eAkB5B"}
|
|
@@ -10,8 +10,7 @@ export function findUserOrganizationFactory({ pg }) {
|
|
|
10
10
|
created_at,
|
|
11
11
|
updated_at,
|
|
12
12
|
verification_type,
|
|
13
|
-
verified_at
|
|
14
|
-
has_been_greeted
|
|
13
|
+
verified_at
|
|
15
14
|
FROM users_organizations
|
|
16
15
|
WHERE organization_id = $1
|
|
17
16
|
AND user_id = $2`, [organization_id, user_id]);
|
|
@@ -3,7 +3,6 @@ export declare function getUserOrganizationFactory({ pg }: DatabaseContext): ({
|
|
|
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
|
-
has_been_greeted: boolean;
|
|
7
6
|
user_id: number;
|
|
8
7
|
organization_id: number;
|
|
9
8
|
created_at: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/get-user-organization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAM5E,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtB,+BAGvC,wBAAwB
|
|
1
|
+
{"version":3,"file":"get-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/get-user-organization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAM5E,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtB,+BAGvC,wBAAwB;;;;;;;;GAO5B"}
|
|
@@ -70,7 +70,6 @@ export declare const BaseUserOrganizationLinkSchema: z.ZodObject<{
|
|
|
70
70
|
no_verification_means_for_small_organization: "no_verification_means_for_small_organization";
|
|
71
71
|
}>;
|
|
72
72
|
verified_at: z.ZodUnion<[z.ZodDate, z.ZodLiteral<null>]>;
|
|
73
|
-
has_been_greeted: z.ZodBoolean;
|
|
74
73
|
}, z.core.$strip>;
|
|
75
74
|
export type BaseUserOrganizationLink = z.output<typeof BaseUserOrganizationLinkSchema>;
|
|
76
75
|
export declare const UserOrganizationLinkSchema: z.ZodObject<{
|
|
@@ -95,7 +94,6 @@ export declare const UserOrganizationLinkSchema: z.ZodObject<{
|
|
|
95
94
|
no_verification_means_for_small_organization: "no_verification_means_for_small_organization";
|
|
96
95
|
}>;
|
|
97
96
|
verified_at: z.ZodUnion<[z.ZodDate, z.ZodLiteral<null>]>;
|
|
98
|
-
has_been_greeted: z.ZodBoolean;
|
|
99
97
|
user_id: z.ZodNumber;
|
|
100
98
|
organization_id: z.ZodNumber;
|
|
101
99
|
created_at: z.ZodDate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-organization-link.d.ts","sourceRoot":"","sources":["../../src/types/user-organization-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAA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AC7C,OAAO,8BAA8B,CACtC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOtC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;iBAU5C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAC/C,OAAO,gCAAgC,CACxC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -42,7 +42,6 @@ export const BaseUserOrganizationLinkSchema = z.object({
|
|
|
42
42
|
verification_type: LinkEnum,
|
|
43
43
|
// updated when verification_type is changed
|
|
44
44
|
verified_at: z.date().or(z.literal(null)),
|
|
45
|
-
has_been_greeted: z.boolean(),
|
|
46
45
|
});
|
|
47
46
|
export const UserOrganizationLinkSchema = BaseUserOrganizationLinkSchema.extend({
|
|
48
47
|
user_id: z.number(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proconnect-gouv/proconnect.identite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"homepage": "https://github.com/proconnect-gouv/proconnect-identite/tree/main/packages/identite#readme",
|
|
5
5
|
"bugs": "https://github.com/proconnect-gouv/proconnect-identite/issues",
|
|
6
6
|
"repository": {
|
package/src/connectors/index.ts
CHANGED
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
findBySiretFactory,
|
|
35
35
|
findByUserIdFactory,
|
|
36
|
-
findByVerifiedEmailDomainFactory,
|
|
37
36
|
findOrganizationByIdFactory,
|
|
38
37
|
findPendingByUserIdFactory,
|
|
39
38
|
getOrganizationByIdFactory,
|
|
@@ -119,7 +118,6 @@ export function createContext({
|
|
|
119
118
|
findById: findOrganizationByIdFactory({ pg }),
|
|
120
119
|
findBySiret: findBySiretFactory({ pg }),
|
|
121
120
|
findByUserId: findByUserIdFactory({ pg }),
|
|
122
|
-
findByVerifiedEmailDomain: findByVerifiedEmailDomainFactory({ pg }),
|
|
123
121
|
findPendingByUserId: findPendingByUserIdFactory({ pg }),
|
|
124
122
|
getById: getOrganizationByIdFactory({ pg }),
|
|
125
123
|
upsert: upsertFactory({ pg }),
|
|
@@ -59,11 +59,11 @@ async function seed() {
|
|
|
59
59
|
|
|
60
60
|
await pg.sql`
|
|
61
61
|
INSERT INTO users_organizations
|
|
62
|
-
(user_id, organization_id, created_at, updated_at, is_external, verification_type
|
|
63
|
-
VALUES (1, 1, '2023-01-25', '2024-02-20', false, 'necron'
|
|
64
|
-
(1, 3, '2023-04-01', '2024-05-05', true, 'alliance'
|
|
65
|
-
(2, 2, '2023-03-01', '2024-04-01', false, 'necron'
|
|
66
|
-
(6, 5, '2023-07-05', '2024-08-15', false, 'imperial'
|
|
62
|
+
(user_id, organization_id, created_at, updated_at, is_external, verification_type)
|
|
63
|
+
VALUES (1, 1, '2023-01-25', '2024-02-20', false, 'necron'),
|
|
64
|
+
(1, 3, '2023-04-01', '2024-05-05', true, 'alliance'),
|
|
65
|
+
(2, 2, '2023-03-01', '2024-04-01', false, 'necron'),
|
|
66
|
+
(6, 5, '2023-07-05', '2024-08-15', false, 'imperial')
|
|
67
67
|
;
|
|
68
68
|
`;
|
|
69
69
|
}
|
|
@@ -27,8 +27,7 @@ exports[`findByUserIdFactory > should return multiple organizations when user ha
|
|
|
27
27
|
"cached_denomination_usuelle_etablissement_principal": null,
|
|
28
28
|
"is_external": false,
|
|
29
29
|
"verification_type": "necron",
|
|
30
|
-
"verified_at": null
|
|
31
|
-
"has_been_greeted": true
|
|
30
|
+
"verified_at": null
|
|
32
31
|
},
|
|
33
32
|
{
|
|
34
33
|
"id": 3,
|
|
@@ -57,8 +56,7 @@ exports[`findByUserIdFactory > should return multiple organizations when user ha
|
|
|
57
56
|
"cached_denomination_usuelle_etablissement_principal": null,
|
|
58
57
|
"is_external": true,
|
|
59
58
|
"verification_type": "alliance",
|
|
60
|
-
"verified_at": null
|
|
61
|
-
"has_been_greeted": false
|
|
59
|
+
"verified_at": null
|
|
62
60
|
}
|
|
63
61
|
]
|
|
64
62
|
`;
|
|
@@ -92,8 +90,7 @@ exports[`findByUserIdFactory > should return single organization when user has o
|
|
|
92
90
|
"cached_denomination_usuelle_etablissement_principal": null,
|
|
93
91
|
"is_external": false,
|
|
94
92
|
"verification_type": "imperial",
|
|
95
|
-
"verified_at": null
|
|
96
|
-
"has_been_greeted": true
|
|
93
|
+
"verified_at": null
|
|
97
94
|
}
|
|
98
95
|
]
|
|
99
96
|
`;
|
|
@@ -17,8 +17,7 @@ export function findByUserIdFactory({ pg }: DatabaseContext) {
|
|
|
17
17
|
SELECT o.*,
|
|
18
18
|
uo.is_external,
|
|
19
19
|
uo.verification_type,
|
|
20
|
-
uo.verified_at
|
|
21
|
-
uo.has_been_greeted
|
|
20
|
+
uo.verified_at
|
|
22
21
|
FROM organizations o
|
|
23
22
|
INNER JOIN users_organizations uo ON uo.organization_id = o.id
|
|
24
23
|
WHERE uo.user_id = $1
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
export * from "./find-by-siret.js";
|
|
4
4
|
export * from "./find-by-user-id.js";
|
|
5
|
-
export * from "./find-by-verified-email-domain.js";
|
|
6
5
|
export * from "./find-organization-by-id.js";
|
|
7
6
|
export * from "./find-pending-by-user-id.js";
|
|
8
7
|
export * from "./get-organization-by-id.js";
|
|
@@ -54,7 +54,6 @@ export const BaseUserOrganizationLinkSchema = z.object({
|
|
|
54
54
|
verification_type: LinkEnum,
|
|
55
55
|
// updated when verification_type is changed
|
|
56
56
|
verified_at: z.date().or(z.literal(null)),
|
|
57
|
-
has_been_greeted: z.boolean(),
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
export type BaseUserOrganizationLink = z.output<
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DatabaseContext } from "#src/types";
|
|
2
|
-
import { type Organization } from "#src/types";
|
|
3
|
-
export declare function findByVerifiedEmailDomainFactory({ pg }: DatabaseContext): (email_domain: string) => Promise<(Organization & {
|
|
4
|
-
member_count: number;
|
|
5
|
-
})[]>;
|
|
6
|
-
//# sourceMappingURL=find-by-verified-email-domain.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-by-verified-email-domain.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-by-verified-email-domain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,gCAAgC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,cAAc,MAAM;kBACP,MAAM;MAmBpE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { EmailDomainApprovedVerificationValues, } from "#src/types";
|
|
3
|
-
import {} from "pg";
|
|
4
|
-
//
|
|
5
|
-
export function findByVerifiedEmailDomainFactory({ pg }) {
|
|
6
|
-
return async function findByVerifiedEmailDomain(email_domain) {
|
|
7
|
-
const { rows } = await pg.query(`
|
|
8
|
-
SELECT o.*, count(u.id)::int as member_count
|
|
9
|
-
FROM organizations o
|
|
10
|
-
INNER JOIN email_domains ed ON ed.organization_id = o.id
|
|
11
|
-
LEFT JOIN users_organizations uo ON uo.organization_id = o.id
|
|
12
|
-
LEFT JOIN users u ON u.id = uo.user_id
|
|
13
|
-
AND substring(u.email FROM '@(.+)$') = $1
|
|
14
|
-
WHERE o.cached_est_active = 'true'
|
|
15
|
-
AND ed.domain = $1
|
|
16
|
-
AND ed.verification_type = ANY ($2)
|
|
17
|
-
GROUP BY o.id
|
|
18
|
-
ORDER BY member_count DESC NULLS LAST;`, [email_domain, EmailDomainApprovedVerificationValues]);
|
|
19
|
-
return rows;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import { emptyDatabase, migrate, pg } from "#testing";
|
|
4
|
-
import assert from "node:assert/strict";
|
|
5
|
-
import { before, beforeEach, suite, test } from "node:test";
|
|
6
|
-
import { findByVerifiedEmailDomainFactory } from "./find-by-verified-email-domain.js";
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
const findByVerifiedEmailDomain = findByVerifiedEmailDomainFactory({
|
|
11
|
-
pg: pg as any,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
suite("findByVerifiedEmailDomainFactory", () => {
|
|
15
|
-
before(migrate);
|
|
16
|
-
beforeEach(emptyDatabase);
|
|
17
|
-
|
|
18
|
-
test("should return empty array when no organization matches the domain", async () => {
|
|
19
|
-
const organizations = await findByVerifiedEmailDomain("absent.world");
|
|
20
|
-
|
|
21
|
-
assert.deepEqual(organizations, []);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("should return matching organization with member_count", async () => {
|
|
25
|
-
await pg.sql`
|
|
26
|
-
INSERT INTO organizations
|
|
27
|
-
(cached_libelle, cached_nom_complet, id, siret, created_at, updated_at, cached_est_active)
|
|
28
|
-
VALUES
|
|
29
|
-
('Necron', 'Necrontyr', 1, '⚰️', '1967-12-19', '1967-12-19', 'true')
|
|
30
|
-
;
|
|
31
|
-
`;
|
|
32
|
-
await pg.sql`
|
|
33
|
-
INSERT INTO email_domains
|
|
34
|
-
(organization_id, domain, verification_type, created_at, updated_at)
|
|
35
|
-
VALUES
|
|
36
|
-
(1, 'darkangels.world', 'verified', '4444-04-04', '4444-04-04')
|
|
37
|
-
;
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
const organizations = await findByVerifiedEmailDomain("darkangels.world");
|
|
41
|
-
|
|
42
|
-
assert.equal(organizations.length, 1);
|
|
43
|
-
assert.equal(organizations[0]?.id, 1);
|
|
44
|
-
assert.equal(organizations[0]?.member_count, 0);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import type { DatabaseContext } from "#src/types";
|
|
4
|
-
import {
|
|
5
|
-
EmailDomainApprovedVerificationValues,
|
|
6
|
-
type Organization,
|
|
7
|
-
} from "#src/types";
|
|
8
|
-
import { type QueryResult } from "pg";
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
export function findByVerifiedEmailDomainFactory({ pg }: DatabaseContext) {
|
|
13
|
-
return async function findByVerifiedEmailDomain(email_domain: string) {
|
|
14
|
-
const { rows }: QueryResult<Organization & { member_count: number }> =
|
|
15
|
-
await pg.query(
|
|
16
|
-
`
|
|
17
|
-
SELECT o.*, count(u.id)::int as member_count
|
|
18
|
-
FROM organizations o
|
|
19
|
-
INNER JOIN email_domains ed ON ed.organization_id = o.id
|
|
20
|
-
LEFT JOIN users_organizations uo ON uo.organization_id = o.id
|
|
21
|
-
LEFT JOIN users u ON u.id = uo.user_id
|
|
22
|
-
AND substring(u.email FROM '@(.+)$') = $1
|
|
23
|
-
WHERE o.cached_est_active = 'true'
|
|
24
|
-
AND ed.domain = $1
|
|
25
|
-
AND ed.verification_type = ANY ($2)
|
|
26
|
-
GROUP BY o.id
|
|
27
|
-
ORDER BY member_count DESC NULLS LAST;`,
|
|
28
|
-
[email_domain, EmailDomainApprovedVerificationValues],
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
return rows;
|
|
32
|
-
};
|
|
33
|
-
}
|