Remove FieldTypeSubtypes

This commit is contained in:
Adria Navarro 2024-04-26 12:18:50 +02:00
parent b7ea425d7e
commit 637f7f514a
6 changed files with 16 additions and 25 deletions

View File

@ -4,7 +4,7 @@
export { OperatorOptions, SqlNumberTypeRangeMap } from "@budibase/shared-core"
export { Feature as Features } from "@budibase/types"
import { BpmCorrelationKey } from "@budibase/shared-core"
import { FieldType, FieldTypeSubtypes } from "@budibase/types"
import { FieldType, FieldSubtype } from "@budibase/types"
// Cookie names
export const Cookies = {
@ -134,7 +134,7 @@ export const TypeIconMap = {
[FieldType.USER]: "User",
[FieldType.USERS]: "UserGroup",
[FieldType.BB_REFERENCE]: {
[FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
[FieldTypeSubtypes.BB_REFERENCE.USERS]: "UserGroup",
[FieldSubtype.USER]: "User",
[FieldSubtype.USERS]: "UserGroup",
},
}

View File

@ -13,7 +13,7 @@ import {
DeleteRow,
FieldSchema,
FieldType,
FieldTypeSubtypes,
FieldSubtype,
FormulaType,
INTERNAL_TABLE_SOURCE_ID,
NumberFieldMetadata,
@ -1015,12 +1015,12 @@ describe.each([
user: {
name: "user",
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
},
users: {
name: "users",
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USERS,
subtype: FieldSubtype.USERS,
},
}),
() => config.createUser(),

View File

@ -2,7 +2,7 @@ import { searchInputMapping } from "../utils"
import { db as dbCore } from "@budibase/backend-core"
import {
FieldType,
FieldTypeSubtypes,
FieldSubtype,
INTERNAL_TABLE_SOURCE_ID,
RowSearchParams,
Table,
@ -20,7 +20,7 @@ const tableWithUserCol: Table = {
user: {
name: "user",
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
},
},
}
@ -35,7 +35,7 @@ const tableWithUsersCol: Table = {
user: {
name: "user",
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USERS,
subtype: FieldSubtype.USERS,
},
},
}

View File

@ -2,7 +2,7 @@ import { inputProcessing } from ".."
import { generator, structures } from "@budibase/backend-core/tests"
import {
FieldType,
FieldTypeSubtypes,
FieldSubtype,
INTERNAL_TABLE_SOURCE_ID,
Table,
TableSourceType,
@ -39,7 +39,7 @@ describe("rowProcessor - inputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: true,
@ -93,7 +93,7 @@ describe("rowProcessor - inputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: false,
@ -135,7 +135,7 @@ describe("rowProcessor - inputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: false,

View File

@ -1,7 +1,6 @@
import {
FieldSubtype,
FieldType,
FieldTypeSubtypes,
FieldSubtype,
INTERNAL_TABLE_SOURCE_ID,
RowAttachment,
Table,
@ -42,7 +41,7 @@ describe("rowProcessor - outputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: false,
@ -175,7 +174,7 @@ describe("rowProcessor - outputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: false,

View File

@ -129,11 +129,3 @@ export enum FieldSubtype {
USER = "user",
USERS = "users",
}
// The 'as' are required for typescript not to type the outputs as generic FieldSubtype
export const FieldTypeSubtypes = {
BB_REFERENCE: {
USER: FieldSubtype.USER as FieldSubtype.USER,
USERS: FieldSubtype.USERS as FieldSubtype.USERS,
},
}