1
0
Fork 0
mirror of synced 2024-09-10 06:26:02 +12:00

Test and fix single reference search

This commit is contained in:
Adria Navarro 2024-04-26 13:38:35 +02:00
parent 24aec6efb1
commit 06b3023b15
3 changed files with 13 additions and 3 deletions

View file

@ -19,7 +19,7 @@ const tableWithUserCol: Table = {
schema: {
user: {
name: "user",
type: FieldType.BB_REFERENCE,
type: FieldType.BB_REFERENCE_SINGLE,
subtype: BBReferenceFieldSubType.USER,
},
},
@ -35,7 +35,7 @@ const tableWithUsersCol: Table = {
user: {
name: "user",
type: FieldType.BB_REFERENCE,
subtype: BBReferenceFieldSubType.USERS,
subtype: BBReferenceFieldSubType.USER,
},
},
}

View file

@ -86,6 +86,16 @@ export function searchInputMapping(table: Table, options: RowSearchParams) {
}
for (let [key, column] of Object.entries(table.schema)) {
switch (column.type) {
case FieldType.BB_REFERENCE_SINGLE:
const subtype = column.subtype
switch (subtype) {
case BBReferenceFieldSubType.USER:
userColumnMapping(key, options)
break
default:
utils.unreachable(subtype)
}
break
case FieldType.BB_REFERENCE: {
const subtype = column.subtype
switch (subtype) {

View file

@ -116,7 +116,7 @@ export interface BBReferenceFieldMetadata
export interface BBReferenceSingleFieldMetadata
extends Omit<BaseFieldSchema, "subtype"> {
type: FieldType.BB_REFERENCE_SINGLE
subtype: BBReferenceFieldSubType
subtype: Exclude<BBReferenceFieldSubType, BBReferenceFieldSubType.USERS>
}
export interface AttachmentFieldMetadata extends BaseFieldSchema {