Clean types

This commit is contained in:
Adria Navarro 2024-04-26 13:30:08 +02:00
parent 2be14deb01
commit 24aec6efb1
5 changed files with 9 additions and 9 deletions

View File

@ -60,10 +60,10 @@ function generateSchema(
case FieldType.OPTIONS:
case FieldType.LONGFORM:
case FieldType.BARCODEQR:
case FieldType.BB_REFERENCE_SINGLE:
schema.text(key)
break
case FieldType.BB_REFERENCE:
case FieldType.BB_REFERENCE_SINGLE: {
case FieldType.BB_REFERENCE: {
const subtype = column.subtype
switch (subtype) {
case BBReferenceFieldSubType.USER:

View File

@ -17,7 +17,7 @@ export function processInputBBReferences(
export function processInputBBReferences(
value: string | string[] | { _id: string } | { _id: string }[],
type: FieldType.BB_REFERENCE,
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
subtype: BBReferenceFieldSubType
): Promise<string | null>
export async function processInputBBReferences(
@ -121,7 +121,7 @@ export function processOutputBBReferences(
export function processOutputBBReferences(
value: string,
type: FieldType.BB_REFERENCE,
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
subtype: BBReferenceFieldSubType
): Promise<UserReferenceInfo[]>
export async function processOutputBBReferences(

View File

@ -170,7 +170,7 @@ export function parse(rows: Rows, schema: TableSchema): Rows {
function isValidBBReference(
data: any,
type: FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE,
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
subtype: BBReferenceFieldSubType
): boolean {
if (typeof data !== "string") {
return false

View File

@ -25,8 +25,8 @@ export const getValidOperatorsForType = (
subtype?: BBReferenceFieldSubType
formulaType?: FormulaType
},
field: string,
datasource: Datasource & { tableId: any }
field?: string,
datasource?: Datasource & { tableId: any }
) => {
const Op = OperatorOptions
const stringOps = [

View File

@ -110,13 +110,13 @@ export interface FormulaFieldMetadata extends BaseFieldSchema {
export interface BBReferenceFieldMetadata
extends Omit<BaseFieldSchema, "subtype"> {
type: FieldType.BB_REFERENCE
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
subtype: BBReferenceFieldSubType
relationshipType?: RelationshipType
}
export interface BBReferenceSingleFieldMetadata
extends Omit<BaseFieldSchema, "subtype"> {
type: FieldType.BB_REFERENCE_SINGLE
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
subtype: BBReferenceFieldSubType
}
export interface AttachmentFieldMetadata extends BaseFieldSchema {