mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 00:52:21 +03:00
feat: add views and viewSorts tables (#1131)
* feat: add views table Closes #1120 * feat: add viewSorts table Closes #1120
This commit is contained in:
parent
428acf4a13
commit
0f364cc9e7
@ -846,6 +846,20 @@ export type EnumPipelineProgressableTypeFilter = {
|
|||||||
notIn?: InputMaybe<Array<PipelineProgressableType>>;
|
notIn?: InputMaybe<Array<PipelineProgressableType>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EnumViewSortDirectionFilter = {
|
||||||
|
equals?: InputMaybe<ViewSortDirection>;
|
||||||
|
in?: InputMaybe<Array<ViewSortDirection>>;
|
||||||
|
not?: InputMaybe<NestedEnumViewSortDirectionFilter>;
|
||||||
|
notIn?: InputMaybe<Array<ViewSortDirection>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EnumViewTypeFilter = {
|
||||||
|
equals?: InputMaybe<ViewType>;
|
||||||
|
in?: InputMaybe<Array<ViewType>>;
|
||||||
|
not?: InputMaybe<NestedEnumViewTypeFilter>;
|
||||||
|
notIn?: InputMaybe<Array<ViewType>>;
|
||||||
|
};
|
||||||
|
|
||||||
export enum FileFolder {
|
export enum FileFolder {
|
||||||
Attachment = 'Attachment',
|
Attachment = 'Attachment',
|
||||||
PersonPicture = 'PersonPicture',
|
PersonPicture = 'PersonPicture',
|
||||||
@ -1178,6 +1192,20 @@ export type NestedEnumPipelineProgressableTypeFilter = {
|
|||||||
notIn?: InputMaybe<Array<PipelineProgressableType>>;
|
notIn?: InputMaybe<Array<PipelineProgressableType>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type NestedEnumViewSortDirectionFilter = {
|
||||||
|
equals?: InputMaybe<ViewSortDirection>;
|
||||||
|
in?: InputMaybe<Array<ViewSortDirection>>;
|
||||||
|
not?: InputMaybe<NestedEnumViewSortDirectionFilter>;
|
||||||
|
notIn?: InputMaybe<Array<ViewSortDirection>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NestedEnumViewTypeFilter = {
|
||||||
|
equals?: InputMaybe<ViewType>;
|
||||||
|
in?: InputMaybe<Array<ViewType>>;
|
||||||
|
not?: InputMaybe<NestedEnumViewTypeFilter>;
|
||||||
|
notIn?: InputMaybe<Array<ViewType>>;
|
||||||
|
};
|
||||||
|
|
||||||
export type NestedIntFilter = {
|
export type NestedIntFilter = {
|
||||||
equals?: InputMaybe<Scalars['Int']>;
|
equals?: InputMaybe<Scalars['Int']>;
|
||||||
gt?: InputMaybe<Scalars['Int']>;
|
gt?: InputMaybe<Scalars['Int']>;
|
||||||
@ -2161,6 +2189,20 @@ export type Verify = {
|
|||||||
user: User;
|
user: User;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type View = {
|
||||||
|
__typename?: 'View';
|
||||||
|
fields?: Maybe<Array<ViewField>>;
|
||||||
|
id: Scalars['ID'];
|
||||||
|
name: Scalars['String'];
|
||||||
|
objectId: Scalars['String'];
|
||||||
|
sorts?: Maybe<Array<ViewSort>>;
|
||||||
|
type: ViewType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewCreateNestedOneWithoutFieldsInput = {
|
||||||
|
connect?: InputMaybe<ViewWhereUniqueInput>;
|
||||||
|
};
|
||||||
|
|
||||||
export type ViewField = {
|
export type ViewField = {
|
||||||
__typename?: 'ViewField';
|
__typename?: 'ViewField';
|
||||||
fieldName: Scalars['String'];
|
fieldName: Scalars['String'];
|
||||||
@ -2169,6 +2211,8 @@ export type ViewField = {
|
|||||||
isVisible: Scalars['Boolean'];
|
isVisible: Scalars['Boolean'];
|
||||||
objectName: Scalars['String'];
|
objectName: Scalars['String'];
|
||||||
sizeInPx: Scalars['Int'];
|
sizeInPx: Scalars['Int'];
|
||||||
|
view?: Maybe<View>;
|
||||||
|
viewId?: Maybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ViewFieldCreateInput = {
|
export type ViewFieldCreateInput = {
|
||||||
@ -2178,6 +2222,7 @@ export type ViewFieldCreateInput = {
|
|||||||
isVisible: Scalars['Boolean'];
|
isVisible: Scalars['Boolean'];
|
||||||
objectName: Scalars['String'];
|
objectName: Scalars['String'];
|
||||||
sizeInPx: Scalars['Int'];
|
sizeInPx: Scalars['Int'];
|
||||||
|
view?: InputMaybe<ViewCreateNestedOneWithoutFieldsInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ViewFieldCreateManyInput = {
|
export type ViewFieldCreateManyInput = {
|
||||||
@ -2187,6 +2232,17 @@ export type ViewFieldCreateManyInput = {
|
|||||||
isVisible: Scalars['Boolean'];
|
isVisible: Scalars['Boolean'];
|
||||||
objectName: Scalars['String'];
|
objectName: Scalars['String'];
|
||||||
sizeInPx: Scalars['Int'];
|
sizeInPx: Scalars['Int'];
|
||||||
|
viewId?: InputMaybe<Scalars['String']>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewFieldListRelationFilter = {
|
||||||
|
every?: InputMaybe<ViewFieldWhereInput>;
|
||||||
|
none?: InputMaybe<ViewFieldWhereInput>;
|
||||||
|
some?: InputMaybe<ViewFieldWhereInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewFieldOrderByRelationAggregateInput = {
|
||||||
|
_count?: InputMaybe<SortOrder>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ViewFieldOrderByWithRelationInput = {
|
export type ViewFieldOrderByWithRelationInput = {
|
||||||
@ -2196,6 +2252,8 @@ export type ViewFieldOrderByWithRelationInput = {
|
|||||||
isVisible?: InputMaybe<SortOrder>;
|
isVisible?: InputMaybe<SortOrder>;
|
||||||
objectName?: InputMaybe<SortOrder>;
|
objectName?: InputMaybe<SortOrder>;
|
||||||
sizeInPx?: InputMaybe<SortOrder>;
|
sizeInPx?: InputMaybe<SortOrder>;
|
||||||
|
view?: InputMaybe<ViewOrderByWithRelationInput>;
|
||||||
|
viewId?: InputMaybe<SortOrder>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum ViewFieldScalarFieldEnum {
|
export enum ViewFieldScalarFieldEnum {
|
||||||
@ -2205,6 +2263,7 @@ export enum ViewFieldScalarFieldEnum {
|
|||||||
IsVisible = 'isVisible',
|
IsVisible = 'isVisible',
|
||||||
ObjectName = 'objectName',
|
ObjectName = 'objectName',
|
||||||
SizeInPx = 'sizeInPx',
|
SizeInPx = 'sizeInPx',
|
||||||
|
ViewId = 'viewId',
|
||||||
WorkspaceId = 'workspaceId'
|
WorkspaceId = 'workspaceId'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2215,6 +2274,7 @@ export type ViewFieldUpdateInput = {
|
|||||||
isVisible?: InputMaybe<Scalars['Boolean']>;
|
isVisible?: InputMaybe<Scalars['Boolean']>;
|
||||||
objectName?: InputMaybe<Scalars['String']>;
|
objectName?: InputMaybe<Scalars['String']>;
|
||||||
sizeInPx?: InputMaybe<Scalars['Int']>;
|
sizeInPx?: InputMaybe<Scalars['Int']>;
|
||||||
|
view?: InputMaybe<ViewUpdateOneWithoutFieldsNestedInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ViewFieldUpdateManyWithoutWorkspaceNestedInput = {
|
export type ViewFieldUpdateManyWithoutWorkspaceNestedInput = {
|
||||||
@ -2233,10 +2293,122 @@ export type ViewFieldWhereInput = {
|
|||||||
isVisible?: InputMaybe<BoolFilter>;
|
isVisible?: InputMaybe<BoolFilter>;
|
||||||
objectName?: InputMaybe<StringFilter>;
|
objectName?: InputMaybe<StringFilter>;
|
||||||
sizeInPx?: InputMaybe<IntFilter>;
|
sizeInPx?: InputMaybe<IntFilter>;
|
||||||
|
view?: InputMaybe<ViewRelationFilter>;
|
||||||
|
viewId?: InputMaybe<StringNullableFilter>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ViewFieldWhereUniqueInput = {
|
export type ViewFieldWhereUniqueInput = {
|
||||||
id?: InputMaybe<Scalars['String']>;
|
id?: InputMaybe<Scalars['String']>;
|
||||||
|
workspaceId_viewId_objectName_fieldName?: InputMaybe<ViewFieldWorkspaceIdViewIdObjectNameFieldNameCompoundUniqueInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewFieldWorkspaceIdViewIdObjectNameFieldNameCompoundUniqueInput = {
|
||||||
|
fieldName: Scalars['String'];
|
||||||
|
objectName: Scalars['String'];
|
||||||
|
viewId: Scalars['String'];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewOrderByWithRelationInput = {
|
||||||
|
fields?: InputMaybe<ViewFieldOrderByRelationAggregateInput>;
|
||||||
|
id?: InputMaybe<SortOrder>;
|
||||||
|
name?: InputMaybe<SortOrder>;
|
||||||
|
objectId?: InputMaybe<SortOrder>;
|
||||||
|
sorts?: InputMaybe<ViewSortOrderByRelationAggregateInput>;
|
||||||
|
type?: InputMaybe<SortOrder>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewRelationFilter = {
|
||||||
|
is?: InputMaybe<ViewWhereInput>;
|
||||||
|
isNot?: InputMaybe<ViewWhereInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewSort = {
|
||||||
|
__typename?: 'ViewSort';
|
||||||
|
direction: ViewSortDirection;
|
||||||
|
key: Scalars['String'];
|
||||||
|
name: Scalars['String'];
|
||||||
|
view: View;
|
||||||
|
viewId: Scalars['String'];
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum ViewSortDirection {
|
||||||
|
Asc = 'asc',
|
||||||
|
Desc = 'desc'
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ViewSortListRelationFilter = {
|
||||||
|
every?: InputMaybe<ViewSortWhereInput>;
|
||||||
|
none?: InputMaybe<ViewSortWhereInput>;
|
||||||
|
some?: InputMaybe<ViewSortWhereInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewSortOrderByRelationAggregateInput = {
|
||||||
|
_count?: InputMaybe<SortOrder>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewSortUpdateManyWithoutWorkspaceNestedInput = {
|
||||||
|
connect?: InputMaybe<Array<ViewSortWhereUniqueInput>>;
|
||||||
|
disconnect?: InputMaybe<Array<ViewSortWhereUniqueInput>>;
|
||||||
|
set?: InputMaybe<Array<ViewSortWhereUniqueInput>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewSortViewIdKeyCompoundUniqueInput = {
|
||||||
|
key: Scalars['String'];
|
||||||
|
viewId: Scalars['String'];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewSortWhereInput = {
|
||||||
|
AND?: InputMaybe<Array<ViewSortWhereInput>>;
|
||||||
|
NOT?: InputMaybe<Array<ViewSortWhereInput>>;
|
||||||
|
OR?: InputMaybe<Array<ViewSortWhereInput>>;
|
||||||
|
direction?: InputMaybe<EnumViewSortDirectionFilter>;
|
||||||
|
key?: InputMaybe<StringFilter>;
|
||||||
|
name?: InputMaybe<StringFilter>;
|
||||||
|
view?: InputMaybe<ViewRelationFilter>;
|
||||||
|
viewId?: InputMaybe<StringFilter>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewSortWhereUniqueInput = {
|
||||||
|
viewId_key?: InputMaybe<ViewSortViewIdKeyCompoundUniqueInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum ViewType {
|
||||||
|
Pipeline = 'Pipeline',
|
||||||
|
Table = 'Table'
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ViewUpdateManyWithoutWorkspaceNestedInput = {
|
||||||
|
connect?: InputMaybe<Array<ViewWhereUniqueInput>>;
|
||||||
|
disconnect?: InputMaybe<Array<ViewWhereUniqueInput>>;
|
||||||
|
set?: InputMaybe<Array<ViewWhereUniqueInput>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewUpdateOneWithoutFieldsNestedInput = {
|
||||||
|
connect?: InputMaybe<ViewWhereUniqueInput>;
|
||||||
|
disconnect?: InputMaybe<Scalars['Boolean']>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewWhereInput = {
|
||||||
|
AND?: InputMaybe<Array<ViewWhereInput>>;
|
||||||
|
NOT?: InputMaybe<Array<ViewWhereInput>>;
|
||||||
|
OR?: InputMaybe<Array<ViewWhereInput>>;
|
||||||
|
fields?: InputMaybe<ViewFieldListRelationFilter>;
|
||||||
|
id?: InputMaybe<StringFilter>;
|
||||||
|
name?: InputMaybe<StringFilter>;
|
||||||
|
objectId?: InputMaybe<StringFilter>;
|
||||||
|
sorts?: InputMaybe<ViewSortListRelationFilter>;
|
||||||
|
type?: InputMaybe<EnumViewTypeFilter>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewWhereUniqueInput = {
|
||||||
|
id?: InputMaybe<Scalars['String']>;
|
||||||
|
workspaceId_type_objectId_name?: InputMaybe<ViewWorkspaceIdTypeObjectIdNameCompoundUniqueInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ViewWorkspaceIdTypeObjectIdNameCompoundUniqueInput = {
|
||||||
|
name: Scalars['String'];
|
||||||
|
objectId: Scalars['String'];
|
||||||
|
type: ViewType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Workspace = {
|
export type Workspace = {
|
||||||
@ -2258,6 +2430,8 @@ export type Workspace = {
|
|||||||
pipelines?: Maybe<Array<Pipeline>>;
|
pipelines?: Maybe<Array<Pipeline>>;
|
||||||
updatedAt: Scalars['DateTime'];
|
updatedAt: Scalars['DateTime'];
|
||||||
viewFields?: Maybe<Array<ViewField>>;
|
viewFields?: Maybe<Array<ViewField>>;
|
||||||
|
viewSorts?: Maybe<Array<ViewSort>>;
|
||||||
|
views?: Maybe<Array<View>>;
|
||||||
workspaceMember?: Maybe<Array<WorkspaceMember>>;
|
workspaceMember?: Maybe<Array<WorkspaceMember>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2337,6 +2511,8 @@ export type WorkspaceUpdateInput = {
|
|||||||
pipelines?: InputMaybe<PipelineUpdateManyWithoutWorkspaceNestedInput>;
|
pipelines?: InputMaybe<PipelineUpdateManyWithoutWorkspaceNestedInput>;
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
viewFields?: InputMaybe<ViewFieldUpdateManyWithoutWorkspaceNestedInput>;
|
viewFields?: InputMaybe<ViewFieldUpdateManyWithoutWorkspaceNestedInput>;
|
||||||
|
viewSorts?: InputMaybe<ViewSortUpdateManyWithoutWorkspaceNestedInput>;
|
||||||
|
views?: InputMaybe<ViewUpdateManyWithoutWorkspaceNestedInput>;
|
||||||
workspaceMember?: InputMaybe<WorkspaceMemberUpdateManyWithoutWorkspaceNestedInput>;
|
workspaceMember?: InputMaybe<WorkspaceMemberUpdateManyWithoutWorkspaceNestedInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ import {
|
|||||||
PipelineProgress,
|
PipelineProgress,
|
||||||
UserSettings,
|
UserSettings,
|
||||||
ViewField,
|
ViewField,
|
||||||
|
View,
|
||||||
|
ViewSort,
|
||||||
} from '@prisma/client';
|
} from '@prisma/client';
|
||||||
|
|
||||||
import { AbilityAction } from './ability.action';
|
import { AbilityAction } from './ability.action';
|
||||||
@ -37,7 +39,9 @@ type SubjectsAbility = Subjects<{
|
|||||||
PipelineProgress: PipelineProgress;
|
PipelineProgress: PipelineProgress;
|
||||||
Attachment: Attachment;
|
Attachment: Attachment;
|
||||||
UserSettings: UserSettings;
|
UserSettings: UserSettings;
|
||||||
|
View: View;
|
||||||
ViewField: ViewField;
|
ViewField: ViewField;
|
||||||
|
ViewSort: ViewSort;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type AppAbility = PureAbility<
|
export type AppAbility = PureAbility<
|
||||||
|
@ -45,7 +45,7 @@ export class ViewFieldResolver {
|
|||||||
): Promise<Partial<ViewField>> {
|
): Promise<Partial<ViewField>> {
|
||||||
return this.viewFieldService.create({
|
return this.viewFieldService.create({
|
||||||
data: {
|
data: {
|
||||||
...args.data,
|
...(args.data as Prisma.ViewFieldCreateInput),
|
||||||
workspace: { connect: { id: workspace.id } },
|
workspace: { connect: { id: workspace.id } },
|
||||||
},
|
},
|
||||||
select: prismaSelect.value,
|
select: prismaSelect.value,
|
||||||
|
@ -111,7 +111,9 @@ export class WorkspaceService {
|
|||||||
comment,
|
comment,
|
||||||
activityTarget,
|
activityTarget,
|
||||||
activity,
|
activity,
|
||||||
|
view,
|
||||||
viewField,
|
viewField,
|
||||||
|
viewSort,
|
||||||
} = this.prismaService.client;
|
} = this.prismaService.client;
|
||||||
|
|
||||||
const activitys = await activity.findMany({
|
const activitys = await activity.findMany({
|
||||||
@ -151,9 +153,15 @@ export class WorkspaceService {
|
|||||||
activity.deleteMany({
|
activity.deleteMany({
|
||||||
where,
|
where,
|
||||||
}),
|
}),
|
||||||
|
view.deleteMany({
|
||||||
|
where,
|
||||||
|
}),
|
||||||
viewField.deleteMany({
|
viewField.deleteMany({
|
||||||
where,
|
where,
|
||||||
}),
|
}),
|
||||||
|
viewSort.deleteMany({
|
||||||
|
where,
|
||||||
|
}),
|
||||||
refreshToken.deleteMany({
|
refreshToken.deleteMany({
|
||||||
where: { userId },
|
where: { userId },
|
||||||
}),
|
}),
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- A unique constraint covering the columns `[workspaceId,viewId,objectName,fieldName]` on the table `viewFields` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "ViewType" AS ENUM ('Table', 'Pipeline');
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "viewFields" ADD COLUMN "viewId" TEXT;
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "views" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"objectId" TEXT NOT NULL,
|
||||||
|
"type" "ViewType" NOT NULL,
|
||||||
|
"workspaceId" TEXT NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "views_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "views_workspaceId_type_objectId_name_key" ON "views"("workspaceId", "type", "objectId", "name");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "viewFields_workspaceId_viewId_objectName_fieldName_key" ON "viewFields"("workspaceId", "viewId", "objectName", "fieldName");
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "companies"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_personId_fkey" FOREIGN KEY ("personId") REFERENCES "people"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "views" ADD CONSTRAINT "views_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "viewFields" ADD CONSTRAINT "viewFields_viewId_fkey" FOREIGN KEY ("viewId") REFERENCES "views"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
@ -0,0 +1,19 @@
|
|||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "ViewSortDirection" AS ENUM ('asc', 'desc');
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "viewSorts" (
|
||||||
|
"direction" "ViewSortDirection" NOT NULL,
|
||||||
|
"key" TEXT NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"viewId" TEXT NOT NULL,
|
||||||
|
"workspaceId" TEXT NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "viewSorts_pkey" PRIMARY KEY ("viewId","key")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "viewSorts" ADD CONSTRAINT "viewSorts_viewId_fkey" FOREIGN KEY ("viewId") REFERENCES "views"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "viewSorts" ADD CONSTRAINT "viewSorts_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -174,6 +174,8 @@ model Workspace {
|
|||||||
pipelineProgresses PipelineProgress[]
|
pipelineProgresses PipelineProgress[]
|
||||||
activityTargets ActivityTarget[]
|
activityTargets ActivityTarget[]
|
||||||
viewFields ViewField[]
|
viewFields ViewField[]
|
||||||
|
views View[]
|
||||||
|
viewSorts ViewSort[]
|
||||||
|
|
||||||
/// @TypeGraphQL.omit(input: true, output: true)
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
deletedAt DateTime?
|
deletedAt DateTime?
|
||||||
@ -557,6 +559,53 @@ model Attachment {
|
|||||||
@@map("attachments")
|
@@map("attachments")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ViewType {
|
||||||
|
Table
|
||||||
|
Pipeline
|
||||||
|
}
|
||||||
|
|
||||||
|
model View {
|
||||||
|
/// @Validator.IsString()
|
||||||
|
/// @Validator.IsOptional()
|
||||||
|
id String @id @default(uuid())
|
||||||
|
|
||||||
|
fields ViewField[]
|
||||||
|
name String
|
||||||
|
objectId String
|
||||||
|
sorts ViewSort[]
|
||||||
|
type ViewType
|
||||||
|
|
||||||
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
|
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||||
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
|
workspaceId String
|
||||||
|
|
||||||
|
@@unique([workspaceId, type, objectId, name])
|
||||||
|
@@map("views")
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ViewSortDirection {
|
||||||
|
asc
|
||||||
|
desc
|
||||||
|
}
|
||||||
|
|
||||||
|
model ViewSort {
|
||||||
|
direction ViewSortDirection
|
||||||
|
key String
|
||||||
|
name String
|
||||||
|
|
||||||
|
view View @relation(fields: [viewId], references: [id])
|
||||||
|
viewId String
|
||||||
|
|
||||||
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
|
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||||
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
|
workspaceId String
|
||||||
|
|
||||||
|
@@id([viewId, key])
|
||||||
|
@@map("viewSorts")
|
||||||
|
}
|
||||||
|
|
||||||
model ViewField {
|
model ViewField {
|
||||||
/// @Validator.IsString()
|
/// @Validator.IsString()
|
||||||
/// @Validator.IsOptional()
|
/// @Validator.IsOptional()
|
||||||
@ -568,10 +617,14 @@ model ViewField {
|
|||||||
objectName String
|
objectName String
|
||||||
sizeInPx Int
|
sizeInPx Int
|
||||||
|
|
||||||
|
view View? @relation(fields: [viewId], references: [id])
|
||||||
|
viewId String?
|
||||||
|
|
||||||
/// @TypeGraphQL.omit(input: true, output: true)
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||||
/// @TypeGraphQL.omit(input: true, output: true)
|
/// @TypeGraphQL.omit(input: true, output: true)
|
||||||
workspaceId String
|
workspaceId String
|
||||||
|
|
||||||
|
@@unique([workspaceId, viewId, objectName, fieldName])
|
||||||
@@map("viewFields")
|
@@map("viewFields")
|
||||||
}
|
}
|
||||||
|
@ -16,5 +16,7 @@ export type ModelSelectMap = {
|
|||||||
PipelineStage: Prisma.PipelineStageSelect;
|
PipelineStage: Prisma.PipelineStageSelect;
|
||||||
PipelineProgress: Prisma.PipelineProgressSelect;
|
PipelineProgress: Prisma.PipelineProgressSelect;
|
||||||
Attachment: Prisma.AttachmentSelect;
|
Attachment: Prisma.AttachmentSelect;
|
||||||
|
View: Prisma.ViewSelect;
|
||||||
|
ViewSort: Prisma.ViewSortSelect;
|
||||||
ViewField: Prisma.ViewFieldSelect;
|
ViewField: Prisma.ViewFieldSelect;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user