Test and fix single reference search
This commit is contained in:
parent
24aec6efb1
commit
06b3023b15
|
@ -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,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue