rewritten OtherId from an array of IdRef (with attribute Type and Value) to a map[string][]string where the key is the type. So basically a conversion from [{"type": "ugent_id", "value": "12334"}, {"type": "ugent_id", "value": "12335"}] to {"ugent_id": ["12334", "12335"]}. See models.IdRefs (plural!). Derivative models in package schema (for ent) and api (for the openapi) also converted. Made use of automatic conversion between compatible models (e.g. models.IdRefs(otherId))
see changes in api/v1/service.go and api/v1/openapi.yml. Rest in api/v1 is generated code
see changes in ent/schema. Rest in ent/ is generated code
repository.GetOrganizationByOtherId(ctx, typ, val) has been changed to repository.GetOrganizationByOtherId(ctx, typ, ...values) in order to accept a list of possible id's to match. This shortens the client, where I previously looped over every value and called this method.
same goes for method repository.GetPersonByOtherId
Notes:
models.IdRefs is a separate type so I could add sugar methods like Add(typ, val) or Remove(type, val) to shorten assignments
Fixes #37
OtherId
from an array ofIdRef
(with attributeType
andValue
) to amap[string][]string
where the key is the type. So basically a conversion from[{"type": "ugent_id", "value": "12334"}, {"type": "ugent_id", "value": "12335"}]
to{"ugent_id": ["12334", "12335"]}
. Seemodels.IdRefs
(plural!). Derivative models in packageschema
(for ent) andapi
(for the openapi) also converted. Made use of automatic conversion between compatible models (e.g.models.IdRefs(otherId)
)api/v1/service.go
andapi/v1/openapi.yml
. Rest inapi/v1
is generated codeent/schema
. Rest inent/
is generated coderepository.GetOrganizationByOtherId(ctx, typ, val)
has been changed torepository.GetOrganizationByOtherId(ctx, typ, ...values)
in order to accept a list of possible id's to match. This shortens the client, where I previously looped over every value and called this method.repository.GetPersonByOtherId
Notes:
models.IdRefs
is a separate type so I could add sugar methods likeAdd(typ, val)
orRemove(type, val)
to shorten assignmentsmodels.Identifiers
like was done in biblio-backoffice: https://github.com/ugent-library/biblio-backoffice/blob/dev/internal/models/identifiers.go#L3. But not sure if you were all happy about that.