-
-
Notifications
You must be signed in to change notification settings - Fork 793
Closed
Description
I'm trying to port feathers-objection and discover in the AdapterServiceOptions that id can only be a string
https://github.com/feathersjs/feathers/blob/dove/packages/adapter-commons/src/declarations.ts#L30
How do we manage composite keys ?
For example, in an association table, where the primary key is composed of the two foreign tables.
Actually, I transform the id property of service options in a string | string[] and rewrite some parts of the _find methods like this
const idColumns = Array.isArray(this.id) ? this.id : [this.id]
const fullIdColumns = idColumns.map((idc: string) => `${this.table}.${idc}`)
// provide default sorting if its not set
if (!filters.$sort) {
builder.orderBy(
fullIdColumns.map((fic: string) => ({
column: fic,
order: 'asc',
})) as ColumnRefOrOrderByDescriptor[],
)
}And also for the count request.
Do you think this is the "right" way to do it, or maybe there is another way ?
Metadata
Metadata
Assignees
Labels
No labels