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

View File

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

View File

@ -2,7 +2,7 @@ import { searchInputMapping } from "../utils"
import { db as dbCore } from "@budibase/backend-core" import { db as dbCore } from "@budibase/backend-core"
import { import {
FieldType, FieldType,
FieldTypeSubtypes, FieldSubtype,
INTERNAL_TABLE_SOURCE_ID, INTERNAL_TABLE_SOURCE_ID,
RowSearchParams, RowSearchParams,
Table, Table,
@ -20,7 +20,7 @@ const tableWithUserCol: Table = {
user: { user: {
name: "user", name: "user",
type: FieldType.BB_REFERENCE, type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER, subtype: FieldSubtype.USER,
}, },
}, },
} }
@ -35,7 +35,7 @@ const tableWithUsersCol: Table = {
user: { user: {
name: "user", name: "user",
type: FieldType.BB_REFERENCE, 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 { generator, structures } from "@budibase/backend-core/tests"
import { import {
FieldType, FieldType,
FieldTypeSubtypes, FieldSubtype,
INTERNAL_TABLE_SOURCE_ID, INTERNAL_TABLE_SOURCE_ID,
Table, Table,
TableSourceType, TableSourceType,
@ -39,7 +39,7 @@ describe("rowProcessor - inputProcessing", () => {
}, },
user: { user: {
type: FieldType.BB_REFERENCE, type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER, subtype: FieldSubtype.USER,
name: "user", name: "user",
constraints: { constraints: {
presence: true, presence: true,
@ -93,7 +93,7 @@ describe("rowProcessor - inputProcessing", () => {
}, },
user: { user: {
type: FieldType.BB_REFERENCE, type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER, subtype: FieldSubtype.USER,
name: "user", name: "user",
constraints: { constraints: {
presence: false, presence: false,
@ -135,7 +135,7 @@ describe("rowProcessor - inputProcessing", () => {
}, },
user: { user: {
type: FieldType.BB_REFERENCE, type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER, subtype: FieldSubtype.USER,
name: "user", name: "user",
constraints: { constraints: {
presence: false, presence: false,

View File

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

View File

@ -129,11 +129,3 @@ export enum FieldSubtype {
USER = "user", USER = "user",
USERS = "users", 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,
},
}