1
0
Fork 0
mirror of synced 2024-09-12 23:43:09 +12:00

Remove FieldTypeSubtypes

This commit is contained in:
Adria Navarro 2024-04-26 12:09:32 +02:00
parent fe226ae54b
commit 61bb40d0d3
7 changed files with 21 additions and 36 deletions

View file

@ -4,7 +4,6 @@ import {
INTERNAL_TABLE_SOURCE_ID,
AutoFieldSubType,
Hosting,
FieldTypeSubtypes,
} from "@budibase/types"
import { Constants } from "@budibase/frontend-core"
@ -162,26 +161,20 @@ export const FIELDS = {
name: "User",
type: FieldType.BB_REFERENCE_SINGLE,
subtype: FieldSubtype.USER,
icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][
FieldTypeSubtypes.BB_REFERENCE.USER
],
icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][FieldSubtype.USER],
},
// Used for display of editing existing columns
OLD_USER: {
name: "User",
type: FieldType.BB_REFERENCE,
subtype: FieldSubtype.USER,
icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][
FieldTypeSubtypes.BB_REFERENCE.USER
],
icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][FieldSubtype.USER],
},
USERS: {
name: "User List",
type: FieldType.BB_REFERENCE,
subtype: FieldSubtype.USERS,
icon: TypeIconMap[FieldType.BB_REFERENCE][
FieldTypeSubtypes.BB_REFERENCE.USERS
],
icon: TypeIconMap[FieldType.BB_REFERENCE][FieldSubtype.USERS],
constraints: {
type: "array",
},

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 = {
@ -132,10 +132,10 @@ export const TypeIconMap = {
[FieldType.BIGINT]: "TagBold",
[FieldType.AUTO]: "MagicWand",
[FieldType.BB_REFERENCE]: {
[FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
[FieldTypeSubtypes.BB_REFERENCE.USERS]: "UserGroup",
[FieldSubtype.USER]: "User",
[FieldSubtype.USERS]: "UserGroup",
},
[FieldType.BB_REFERENCE_SINGLE]: {
[FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
[FieldSubtype.USER]: "User",
},
}

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,
@ -94,7 +94,7 @@ describe("rowProcessor - inputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: false,
@ -136,7 +136,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,
@ -176,7 +175,7 @@ describe("rowProcessor - outputProcessing", () => {
},
user: {
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USER,
subtype: FieldSubtype.USER,
name: "user",
constraints: {
presence: false,

View file

@ -131,13 +131,6 @@ export interface Row extends Document {
export enum FieldSubtype {
USER = "user",
/** @deprecated this should not be used anymore */
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,
},
}