Skip to content

Commit 7e385d9

Browse files
guillermauJeromeBu
authored andcommitted
#298 : fix name
1 parent ca22213 commit 7e385d9

File tree

8 files changed

+74
-68
lines changed

8 files changed

+74
-68
lines changed

api/src/core/adapters/dbApi/kysely/createPgSoftwareRepository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
154154
updateTime: new Date(+updateTime).getTime(),
155155
referencedSinceTime: referencedSinceTime ? new Date(+referencedSinceTime).getTime() : undefined,
156156
serviceProviders: serviceProviders ?? [],
157-
similarSoftwares: similarExternalSoftwares,
157+
similarExternalSoftwares: similarExternalSoftwares,
158158
userAndReferentCountByOrganization: {},
159159
authors: (softwareExternalData?.developers ?? []).map(dev => ({
160160
"@type": "Person",
@@ -251,7 +251,7 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
251251
? new Date(+referencedSinceTime).getTime()
252252
: undefined,
253253
serviceProviders: serviceProviders ?? [],
254-
similarSoftwares: similarExternalSoftwares,
254+
similarExternalSoftwares: similarExternalSoftwares,
255255
// (similarSoftwares ?? []).map(
256256
// (s): SimilarSoftware => ({
257257
// softwareName:
@@ -534,7 +534,7 @@ const makeGetSoftwareById =
534534
referencedSinceTime: referencedSinceTime ? new Date(+referencedSinceTime).getTime() : undefined,
535535
isReferenced: referencedSinceTime ? true : false,
536536
serviceProviders: serviceProviders ?? [],
537-
similarSoftwares: similarExternalSoftwares,
537+
similarExternalSoftwares: similarExternalSoftwares,
538538
userAndReferentCountByOrganization: {},
539539
authors: (softwareExternalData?.developers ?? []).map(dev => ({
540540
"@type": "Person",

api/src/core/adapters/dbApi/kysely/pgDbApi.integration.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ describe("pgDbApi", () => {
172172
expectToEqual(actualSoftware, {
173173
referencedSinceTime: expect.any(Number),
174174
updateTime: expect.any(Number),
175-
annuaireCnllServiceProviders: undefined,
176175
applicationCategories: ["Software Cat I", "Software Cat II"],
177176
authors: softwareExternalData.developers.map(dev => ({
178177
"@type": "Person" as const,
@@ -183,16 +182,11 @@ describe("pgDbApi", () => {
183182
codeRepositoryUrl: softwareExternalData.sourceUrl,
184183
comptoirDuLibreId: 50,
185184
comptoirDuLibreServiceProviderCount: 0,
186-
dereferencing: undefined,
187185
documentationUrl: softwareExternalData.documentationUrl,
188186
externalDataOrigin: "wikidata",
189187
externalId,
190188
isReferenced: true,
191189
keywords: ["bob", "l'éponge"],
192-
latestVersion: {
193-
"publicationTime": 1561566581000,
194-
"semVer": "1.0.0"
195-
},
196190
license: "MIT",
197191
logoUrl: "https://example.com/logo.png",
198192
officialWebsiteUrl: softwareExternalData.websiteUrl,
@@ -208,7 +202,16 @@ describe("pgDbApi", () => {
208202
},
209203
programmingLanguages: ["C++"],
210204
serviceProviders: [],
211-
similarSoftwares: [],
205+
similarExternalSoftwares: [
206+
{
207+
externalDataOrigin: "wikidata",
208+
externalId: similarSoftwareExternalData.externalId,
209+
label: similarSoftwareExternalData.label,
210+
description: similarSoftwareExternalData.description,
211+
isLibreSoftware: similarSoftwareExternalData.isLibreSoftware,
212+
isInSill: false
213+
}
214+
],
212215
softwareDescription: "Super software",
213216
softwareId: expect.any(Number),
214217
softwareName: softwareFormData.softwareName,

api/src/core/usecases/readWriteSillData/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export type Software = {
1919
softwareName: string;
2020
softwareDescription: string;
2121
serviceProviders: ServiceProvider[];
22-
latestVersion:
22+
latestVersion?:
2323
| {
2424
semVer?: string;
2525
publicationTime?: number;
2626
}
2727
| undefined;
2828
referencedSinceTime: number | undefined;
2929
updateTime: number;
30-
dereferencing:
30+
dereferencing?:
3131
| {
3232
reason?: string;
3333
time: number;
@@ -44,7 +44,7 @@ export type Software = {
4444
versionMin: string | undefined;
4545
license: string;
4646
comptoirDuLibreServiceProviderCount: number;
47-
annuaireCnllServiceProviders:
47+
annuaireCnllServiceProviders?:
4848
| {
4949
name: string;
5050
siren: string;
@@ -56,7 +56,7 @@ export type Software = {
5656
externalDataOrigin: ExternalDataOrigin | undefined;
5757
softwareType: SoftwareType;
5858
parentWikidataSoftware: ParentSoftwareExternalData | undefined;
59-
similarSoftwares: Software.SimilarSoftware[];
59+
similarExternalSoftwares: Software.SimilarSoftware[];
6060
keywords: string[];
6161
programmingLanguages: string[];
6262
referencePublications?: SILL.ScholarlyArticle[];

web/src/core/adapter/sillApiMock.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const sillApi: SillApi = {
9090
latestVersion: undefined,
9191
parentWikidataSoftware: undefined,
9292
softwareType: formData.softwareType,
93-
similarSoftwares: [],
93+
similarExternalSoftwares: [],
9494
referencedSinceTime: Date.now(),
9595
updateTime: Date.now(),
9696
applicationCategories: [],
@@ -144,7 +144,7 @@ export const sillApi: SillApi = {
144144
latestVersion: undefined,
145145
parentWikidataSoftware: undefined,
146146
softwareType: formData.softwareType,
147-
similarSoftwares: [],
147+
similarExternalSoftwares: [],
148148
referencedSinceTime: Date.now(),
149149
updateTime: Date.now(),
150150
applicationCategories: [],
@@ -293,7 +293,7 @@ const softwares = [
293293
comptoirDuLibreServiceProviderCount: 29,
294294
comptoirDuLibreId: 117,
295295
annuaireCnllServiceProviders: [],
296-
similarSoftwares: [
296+
similarExternalSoftwares: [
297297
{
298298
description:
299299
"team collaboration and videoconferencing application developed by Microsoft",
@@ -350,7 +350,7 @@ const softwares = [
350350
comptoirDuLibreServiceProviderCount: 22,
351351
comptoirDuLibreId: 33,
352352
annuaireCnllServiceProviders: [],
353-
similarSoftwares: [
353+
similarExternalSoftwares: [
354354
{
355355
description:
356356
"team collaboration and videoconferencing application developed by Microsoft",
@@ -425,7 +425,7 @@ const softwares = [
425425
comptoirDuLibreServiceProviderCount: 24,
426426
comptoirDuLibreId: 38,
427427
annuaireCnllServiceProviders: [],
428-
similarSoftwares: [],
428+
similarExternalSoftwares: [],
429429
externalId: "Q10135",
430430
externalDataOrigin: "wikidata",
431431
softwareType: {
@@ -479,7 +479,7 @@ const softwares = [
479479
comptoirDuLibreServiceProviderCount: 5,
480480
comptoirDuLibreId: 62,
481481
annuaireCnllServiceProviders: [],
482-
similarSoftwares: [],
482+
similarExternalSoftwares: [],
483483
externalId: "Q171477",
484484
externalDataOrigin: "wikidata",
485485
license: "GPL-2.0-only",
@@ -531,7 +531,7 @@ const softwares = [
531531
comptoirDuLibreServiceProviderCount: 16,
532532
comptoirDuLibreId: 241,
533533
annuaireCnllServiceProviders: [],
534-
similarSoftwares: [
534+
similarExternalSoftwares: [
535535
{
536536
description:
537537
"team collaboration and videoconferencing application developed by Microsoft",
@@ -621,7 +621,7 @@ const softwares = [
621621
ios: true
622622
}
623623
},
624-
similarSoftwares: [
624+
similarExternalSoftwares: [
625625
{
626626
description:
627627
"team collaboration and videoconferencing application developed by Microsoft",
@@ -666,7 +666,7 @@ const softwares = [
666666
comptoirDuLibreServiceProviderCount: 14,
667667
comptoirDuLibreId: 60,
668668
annuaireCnllServiceProviders: [],
669-
similarSoftwares: [],
669+
similarExternalSoftwares: [],
670670
externalId: "Q1329181",
671671
externalDataOrigin: "wikidata",
672672
license: "GPL-2.0-or-later",
@@ -771,7 +771,7 @@ const softwares = [
771771
ios: true
772772
}
773773
},
774-
similarSoftwares: [],
774+
similarExternalSoftwares: [],
775775
userAndReferentCountByOrganization: {
776776
DINUM: { referentCount: 2, userCount: 43 }
777777
},
@@ -800,7 +800,7 @@ const softwares = [
800800
comptoirDuLibreServiceProviderCount: 17,
801801
comptoirDuLibreId: 123,
802802
annuaireCnllServiceProviders: [],
803-
similarSoftwares: [],
803+
similarExternalSoftwares: [],
804804
externalId: "Q192490",
805805
externalDataOrigin: "wikidata",
806806
license: "PostgreSQL",
@@ -847,7 +847,7 @@ const softwares = [
847847
comptoirDuLibreServiceProviderCount: 5,
848848
comptoirDuLibreId: 140,
849849
annuaireCnllServiceProviders: [],
850-
similarSoftwares: [],
850+
similarExternalSoftwares: [],
851851
externalId: "Q50938515",
852852
externalDataOrigin: "wikidata",
853853
license: "AGPL-3.0-or-later",
@@ -911,7 +911,7 @@ const softwares = [
911911
ios: true
912912
}
913913
},
914-
similarSoftwares: [],
914+
similarExternalSoftwares: [],
915915
referencedSinceTime: 1674739365178,
916916
updateTime: 1674739365178,
917917
dereferencing: undefined,
@@ -957,7 +957,7 @@ const softwares = [
957957
ios: true
958958
}
959959
},
960-
similarSoftwares: [],
960+
similarExternalSoftwares: [],
961961
referencedSinceTime: 1674739365178,
962962
updateTime: 1674739365178,
963963
dereferencing: undefined,
@@ -1003,7 +1003,7 @@ const softwares = [
10031003
ios: true
10041004
}
10051005
},
1006-
similarSoftwares: [],
1006+
similarExternalSoftwares: [],
10071007
referencedSinceTime: 1674739365178,
10081008
updateTime: 1674739365178,
10091009
dereferencing: undefined,
@@ -1049,7 +1049,7 @@ const softwares = [
10491049
ios: true
10501050
}
10511051
},
1052-
similarSoftwares: [],
1052+
similarExternalSoftwares: [],
10531053
referencedSinceTime: 1674739365178,
10541054
updateTime: 1674739365178,
10551055
dereferencing: undefined,
@@ -1095,7 +1095,7 @@ const softwares = [
10951095
ios: true
10961096
}
10971097
},
1098-
similarSoftwares: [],
1098+
similarExternalSoftwares: [],
10991099
referencedSinceTime: 1674739365178,
11001100
updateTime: 1674739365178,
11011101
dereferencing: undefined,
@@ -1141,7 +1141,7 @@ const softwares = [
11411141
ios: true
11421142
}
11431143
},
1144-
similarSoftwares: [],
1144+
similarExternalSoftwares: [],
11451145
referencedSinceTime: 1674739365178,
11461146
updateTime: 1674739365178,
11471147
dereferencing: undefined,
@@ -1187,7 +1187,7 @@ const softwares = [
11871187
ios: true
11881188
}
11891189
},
1190-
similarSoftwares: [],
1190+
similarExternalSoftwares: [],
11911191
referencedSinceTime: 1674739365178,
11921192
updateTime: 1674739365178,
11931193
dereferencing: undefined,
@@ -1233,7 +1233,7 @@ const softwares = [
12331233
ios: true
12341234
}
12351235
},
1236-
similarSoftwares: [],
1236+
similarExternalSoftwares: [],
12371237
referencedSinceTime: 1674739365178,
12381238
updateTime: 1674739365178,
12391239
dereferencing: undefined,

web/src/core/usecases/softwareCatalog/selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ function apiSoftwareToInternalSoftware(params: {
862862
prerogatives,
863863
softwareType,
864864
userAndReferentCountByOrganization,
865-
similarSoftwares,
865+
similarExternalSoftwares,
866866
keywords,
867867
programmingLanguages,
868868
referencePublications
@@ -931,7 +931,7 @@ function apiSoftwareToInternalSoftware(params: {
931931
" (" +
932932
[
933933
...keywords,
934-
...similarSoftwares
934+
...similarExternalSoftwares
935935
.map(similarSoftware =>
936936
similarSoftware.isInSill
937937
? similarSoftware.softwareName

web/src/core/usecases/softwareCatalog/thunks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function apiSoftwareToInternalSoftware(params: {
226226
prerogatives,
227227
softwareType,
228228
userAndReferentCountByOrganization,
229-
similarSoftwares,
229+
similarExternalSoftwares,
230230
keywords,
231231
programmingLanguages
232232
} = apiSoftware;
@@ -312,7 +312,7 @@ function apiSoftwareToInternalSoftware(params: {
312312
" (" +
313313
[
314314
...keywords,
315-
...similarSoftwares
315+
...similarExternalSoftwares
316316
.map(similarSoftware =>
317317
similarSoftware.isInSill
318318
? similarSoftware.softwareName

web/src/core/usecases/softwareDetails/thunks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function apiSoftwareToSoftware(params: {
183183
prerogatives,
184184
comptoirDuLibreServiceProviderCount,
185185
comptoirDuLibreId,
186-
similarSoftwares: similarSoftwares_api,
186+
similarExternalSoftwares: similarSoftwares_api,
187187
externalDataOrigin,
188188
externalId,
189189
license,

web/src/core/usecases/softwareForm/thunks.ts

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -109,36 +109,39 @@ export const thunks = {
109109
doRespectRgaa: software.prerogatives.doRespectRgaa
110110
},
111111
step4: {
112-
similarSoftwares: software.similarSoftwares
113-
.map(similarSoftware => {
114-
if (!similarSoftware.isInSill) {
115-
return similarSoftware;
116-
} else {
117-
const software = softwares.find(
118-
software =>
119-
software.softwareName ===
120-
similarSoftware.softwareName
121-
);
122-
123-
if (
124-
software === undefined ||
125-
software.externalId === undefined
126-
) {
127-
return undefined;
112+
similarSoftwares:
113+
software.similarExternalSoftwares
114+
.map(similarSoftware => {
115+
if (!similarSoftware.isInSill) {
116+
return similarSoftware;
117+
} else {
118+
const software = softwares.find(
119+
software =>
120+
software.softwareName ===
121+
similarSoftware.softwareName
122+
);
123+
124+
if (
125+
software === undefined ||
126+
software.externalId ===
127+
undefined
128+
) {
129+
return undefined;
130+
}
131+
132+
return {
133+
label: software.softwareName,
134+
description:
135+
software.softwareDescription,
136+
isLibreSoftware: true,
137+
externalId:
138+
software.externalId,
139+
externalDataOrigin:
140+
software.externalDataOrigin
141+
};
128142
}
129-
130-
return {
131-
label: software.softwareName,
132-
description:
133-
software.softwareDescription,
134-
isLibreSoftware: true,
135-
externalId: software.externalId,
136-
externalDataOrigin:
137-
software.externalDataOrigin
138-
};
139-
}
140-
})
141-
.filter(exclude(undefined))
143+
})
144+
.filter(exclude(undefined))
142145
}
143146
}
144147
})

0 commit comments

Comments
 (0)