@@ -2,7 +2,6 @@ import { Kysely, sql } from "kysely";
22import type { Equals } from "tsafe" ;
33import { assert } from "tsafe/assert" ;
44import { SoftwareRepository } from "../../../ports/DbApiV2" ;
5- import { ParentSoftwareExternalData } from "../../../ports/GetSoftwareExternalData" ;
65import { Software } from "../../../usecases/readWriteSillData" ;
76import { Database } from "./kysely.database" ;
87import { stripNullOrUndefinedValues , jsonBuildObject } from "./kysely.utils" ;
@@ -55,7 +54,6 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
5554 updateTime : now ,
5655 dereferencing : undefined ,
5756 isStillInObservation : false ,
58- parentSoftwareWikidataId : undefined ,
5957 doRespectRgaa : doRespectRgaa ,
6058 isFromFrenchPublicService : isFromFrenchPublicService ,
6159 isPresentInSupportContract : isPresentInSupportContract ,
@@ -132,7 +130,6 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
132130 versionMin : softwareMinimalVersion || null ,
133131 updateTime : now ,
134132 isStillInObservation : false ,
135- parentSoftwareWikidataId : undefined ,
136133 doRespectRgaa : doRespectRgaa ,
137134 isFromFrenchPublicService : isFromFrenchPublicService ,
138135 isPresentInSupportContract : isPresentInSupportContract ,
@@ -156,7 +153,6 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
156153 if ( ! result ) return ;
157154 const {
158155 serviceProviders,
159- parentExternalData,
160156 updateTime,
161157 addedTime,
162158 softwareExternalData,
@@ -184,7 +180,6 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
184180 software . comptoirDuLibreSoftware ?. external_resources . repository ,
185181 documentationUrl : softwareExternalData ?. documentationUrl ,
186182 comptoirDuLibreServiceProviderCount : software . comptoirDuLibreSoftware ?. providers . length ?? 0 ,
187- parentWikidataSoftware : parentExternalData ,
188183 keywords : software ?. keywords ?? softwareExternalData ?. keywords ?? [ ] ,
189184 programmingLanguages : softwareExternalData ?. programmingLanguages ?? [ ] ,
190185 referencePublications : softwareExternalData ?. referencePublications ,
@@ -200,11 +195,10 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
200195 const software = await getBySoftwareId ( softwareId ) ;
201196 if ( ! software ) return ;
202197
203- const { parentSoftwareExternalId , similarSoftwaresExternalIds } = await db
198+ const { similarSoftwaresExternalIds } = await db
204199 . selectFrom ( "softwares as s" )
205200 . leftJoin ( "softwares__similar_software_external_datas as sim" , "sim.softwareId" , "s.id" )
206201 . select ( [
207- "s.parentSoftwareWikidataId as parentSoftwareExternalId" ,
208202 qb =>
209203 qb . fn
210204 . jsonAgg ( qb . ref ( "sim.similarExternalId" ) )
@@ -218,8 +212,7 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
218212
219213 return {
220214 software,
221- similarSoftwaresExternalIds : similarSoftwaresExternalIds ?? [ ] ,
222- parentSoftwareExternalId : parentSoftwareExternalId ?? undefined
215+ similarSoftwaresExternalIds : similarSoftwaresExternalIds ?? [ ]
223216 } ;
224217 } ,
225218 getAll : ( { onlyIfUpdatedMoreThan3HoursAgo } = { } ) : Promise < Software [ ] > => {
@@ -240,7 +233,6 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
240233 return softwares . map (
241234 ( {
242235 serviceProviders,
243- parentExternalData,
244236 updateTime,
245237 addedTime,
246238 softwareExternalData,
@@ -285,7 +277,6 @@ export const createPgSoftwareRepository = (db: Kysely<Database>): SoftwareReposi
285277 documentationUrl : softwareExternalData ?. documentationUrl ?? undefined ,
286278 comptoirDuLibreServiceProviderCount :
287279 software . comptoirDuLibreSoftware ?. providers . length ?? 0 ,
288- parentWikidataSoftware : parentExternalData ?? undefined ,
289280 applicationCategories : software . categories . concat (
290281 softwareExternalData ?. applicationCategories ?? [ ]
291282 ) ,
@@ -341,7 +332,6 @@ const makeGetSoftwareBuilder = (db: Kysely<Database>) =>
341332 . selectFrom ( "softwares as s" )
342333 . leftJoin ( "software_external_datas as ext" , "ext.externalId" , "s.externalId" )
343334 . leftJoin ( "compiled_softwares as cs" , "cs.softwareId" , "s.id" )
344- . leftJoin ( "software_external_datas as parentExt" , "s.parentSoftwareWikidataId" , "parentExt.externalId" )
345335 . leftJoin (
346336 "softwares__similar_software_external_datas" ,
347337 "softwares__similar_software_external_datas.softwareId" ,
@@ -359,8 +349,7 @@ const makeGetSoftwareBuilder = (db: Kysely<Database>) =>
359349 "cs.comptoirDuLibreSoftware" ,
360350 "cs.latestVersion" ,
361351 "cs.serviceProviders" ,
362- "ext.externalId" ,
363- "parentExt.externalId"
352+ "ext.externalId"
364353 ] )
365354 . orderBy ( "s.id" , "asc" )
366355 . select ( [
@@ -396,20 +385,6 @@ const makeGetSoftwareBuilder = (db: Kysely<Database>) =>
396385 "s.externalId" ,
397386 "s.externalDataOrigin" ,
398387 "s.softwareType" ,
399- ( { ref, ...qb } ) =>
400- qb
401- . case ( )
402- . when ( "parentExt.externalId" , "is not" , null )
403- . then (
404- jsonBuildObject ( {
405- externalId : ref ( "parentExt.externalId" ) ,
406- label : ref ( "parentExt.label" ) ,
407- description : ref ( "parentExt.description" )
408- } ) . $castTo < ParentSoftwareExternalData > ( )
409- )
410- . else ( null )
411- . end ( )
412- . as ( "parentExternalData" ) ,
413388 "s.keywords" ,
414389 ( { ref } ) =>
415390 jsonBuildObject ( {
@@ -529,7 +504,6 @@ const makeGetSoftwareById =
529504 if ( ! result ) return ;
530505 const {
531506 serviceProviders,
532- parentExternalData,
533507 updateTime,
534508 addedTime,
535509 softwareExternalData,
@@ -557,7 +531,6 @@ const makeGetSoftwareById =
557531 software . comptoirDuLibreSoftware ?. external_resources . repository ,
558532 documentationUrl : softwareExternalData ?. documentationUrl ,
559533 comptoirDuLibreServiceProviderCount : software . comptoirDuLibreSoftware ?. providers . length ?? 0 ,
560- parentWikidataSoftware : parentExternalData ,
561534 programmingLanguages : softwareExternalData ?. programmingLanguages ?? [ ] ,
562535 referencePublications : softwareExternalData ?. referencePublications ,
563536 identifiers : softwareExternalData ?. identifiers ,
0 commit comments