Clean types
This commit is contained in:
parent
2be14deb01
commit
24aec6efb1
|
@ -60,10 +60,10 @@ function generateSchema(
|
||||||
case FieldType.OPTIONS:
|
case FieldType.OPTIONS:
|
||||||
case FieldType.LONGFORM:
|
case FieldType.LONGFORM:
|
||||||
case FieldType.BARCODEQR:
|
case FieldType.BARCODEQR:
|
||||||
|
case FieldType.BB_REFERENCE_SINGLE:
|
||||||
schema.text(key)
|
schema.text(key)
|
||||||
break
|
break
|
||||||
case FieldType.BB_REFERENCE:
|
case FieldType.BB_REFERENCE: {
|
||||||
case FieldType.BB_REFERENCE_SINGLE: {
|
|
||||||
const subtype = column.subtype
|
const subtype = column.subtype
|
||||||
switch (subtype) {
|
switch (subtype) {
|
||||||
case BBReferenceFieldSubType.USER:
|
case BBReferenceFieldSubType.USER:
|
||||||
|
|
|
@ -17,7 +17,7 @@ export function processInputBBReferences(
|
||||||
export function processInputBBReferences(
|
export function processInputBBReferences(
|
||||||
value: string | string[] | { _id: string } | { _id: string }[],
|
value: string | string[] | { _id: string } | { _id: string }[],
|
||||||
type: FieldType.BB_REFERENCE,
|
type: FieldType.BB_REFERENCE,
|
||||||
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
|
subtype: BBReferenceFieldSubType
|
||||||
): Promise<string | null>
|
): Promise<string | null>
|
||||||
|
|
||||||
export async function processInputBBReferences(
|
export async function processInputBBReferences(
|
||||||
|
@ -121,7 +121,7 @@ export function processOutputBBReferences(
|
||||||
export function processOutputBBReferences(
|
export function processOutputBBReferences(
|
||||||
value: string,
|
value: string,
|
||||||
type: FieldType.BB_REFERENCE,
|
type: FieldType.BB_REFERENCE,
|
||||||
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
|
subtype: BBReferenceFieldSubType
|
||||||
): Promise<UserReferenceInfo[]>
|
): Promise<UserReferenceInfo[]>
|
||||||
|
|
||||||
export async function processOutputBBReferences(
|
export async function processOutputBBReferences(
|
||||||
|
|
|
@ -170,7 +170,7 @@ export function parse(rows: Rows, schema: TableSchema): Rows {
|
||||||
function isValidBBReference(
|
function isValidBBReference(
|
||||||
data: any,
|
data: any,
|
||||||
type: FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE,
|
type: FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE,
|
||||||
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
|
subtype: BBReferenceFieldSubType
|
||||||
): boolean {
|
): boolean {
|
||||||
if (typeof data !== "string") {
|
if (typeof data !== "string") {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -25,8 +25,8 @@ export const getValidOperatorsForType = (
|
||||||
subtype?: BBReferenceFieldSubType
|
subtype?: BBReferenceFieldSubType
|
||||||
formulaType?: FormulaType
|
formulaType?: FormulaType
|
||||||
},
|
},
|
||||||
field: string,
|
field?: string,
|
||||||
datasource: Datasource & { tableId: any }
|
datasource?: Datasource & { tableId: any }
|
||||||
) => {
|
) => {
|
||||||
const Op = OperatorOptions
|
const Op = OperatorOptions
|
||||||
const stringOps = [
|
const stringOps = [
|
||||||
|
|
|
@ -110,13 +110,13 @@ export interface FormulaFieldMetadata extends BaseFieldSchema {
|
||||||
export interface BBReferenceFieldMetadata
|
export interface BBReferenceFieldMetadata
|
||||||
extends Omit<BaseFieldSchema, "subtype"> {
|
extends Omit<BaseFieldSchema, "subtype"> {
|
||||||
type: FieldType.BB_REFERENCE
|
type: FieldType.BB_REFERENCE
|
||||||
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
|
subtype: BBReferenceFieldSubType
|
||||||
relationshipType?: RelationshipType
|
relationshipType?: RelationshipType
|
||||||
}
|
}
|
||||||
export interface BBReferenceSingleFieldMetadata
|
export interface BBReferenceSingleFieldMetadata
|
||||||
extends Omit<BaseFieldSchema, "subtype"> {
|
extends Omit<BaseFieldSchema, "subtype"> {
|
||||||
type: FieldType.BB_REFERENCE_SINGLE
|
type: FieldType.BB_REFERENCE_SINGLE
|
||||||
subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS
|
subtype: BBReferenceFieldSubType
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AttachmentFieldMetadata extends BaseFieldSchema {
|
export interface AttachmentFieldMetadata extends BaseFieldSchema {
|
||||||
|
|
Loading…
Reference in New Issue