diff --git a/app/components/templates/card/dashboard-entity-cards.tsx b/app/components/templates/card/dashboard-entity-cards.tsx index 6708c0ea..9557066a 100644 --- a/app/components/templates/card/dashboard-entity-cards.tsx +++ b/app/components/templates/card/dashboard-entity-cards.tsx @@ -6,7 +6,7 @@ import { DashboardCardNone, DashboardCardWrapper, } from '#app/components/layout' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IProjectWithArtboards } from '#app/models/project/project.server' type DashboardCardEntitiesType = IProjectWithArtboards[] | IArtboard[] diff --git a/app/definitions/artboard-generator.ts b/app/definitions/artboard-generator.ts index 747effee..f59774a4 100644 --- a/app/definitions/artboard-generator.ts +++ b/app/definitions/artboard-generator.ts @@ -1,14 +1,14 @@ +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' -import { type IFill } from '#app/models/fill.server' -import { type ILayer } from '#app/models/layer.server' -import { type ILayout } from '#app/models/layout.server' -import { type ILine } from '#app/models/line.server' -import { type IPalette } from '#app/models/palette.server' -import { type IRotate } from '#app/models/rotate.server' -import { type ISize } from '#app/models/size.server' -import { type IStroke } from '#app/models/stroke.server' -import { type ITemplate } from '#app/models/template.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' +import { type ILine } from '#app/models/design-type/line/line.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' +import { type ISize } from '#app/models/design-type/size/size.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' +import { type ITemplate } from '#app/models/design-type/template/template.server' +import { type ILayer } from '#app/models/layer/layer.server' // object sent to the client // generator has final building blocks for the generation(s) diff --git a/app/models/artboard-branch/artboard-branch.create.server.ts b/app/models/artboard-branch/artboard-branch.create.server.ts index a855be00..9bde9968 100644 --- a/app/models/artboard-branch/artboard-branch.create.server.ts +++ b/app/models/artboard-branch/artboard-branch.create.server.ts @@ -3,7 +3,7 @@ import { NewArtboardBranchSchema } from '#app/schema/artboard-branch' import { ValidateArtboardParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { prisma } from '#app/utils/db.server' -import { type IArtboard } from '../artboard.server' +import { type IArtboard } from '../artboard/artboard.server' import { type IUser } from '../user/user.server' import { type IArtboardBranch, diff --git a/app/models/artboard-version/artboard-version.server.ts b/app/models/artboard-version/artboard-version.server.ts index 7861dc1d..922e4aad 100644 --- a/app/models/artboard-version/artboard-version.server.ts +++ b/app/models/artboard-version/artboard-version.server.ts @@ -1,7 +1,7 @@ import { type ArtboardVersion } from '@prisma/client' import { type DateOrString } from '#app/definitions/prisma-helper' -import { type IDesignWithType } from '../design.server' -import { type ILayerWithDesigns } from '../layer.server' +import { type IDesignWithType } from '../design/design.server' +import { type ILayerWithDesigns } from '../layer/layer.server' // Omitting 'createdAt' and 'updatedAt' from the ArtboardVersion interface // prisma query returns a string for these fields diff --git a/app/models/artboard.server.ts b/app/models/artboard.server.ts deleted file mode 100644 index 77f5bf43..00000000 --- a/app/models/artboard.server.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { type Artboard } from '@prisma/client' -import { type DateOrString } from '#app/definitions/prisma-helper' -import { - type findArtboardArgsType, - type selectArgsType, - type whereArgsType, -} from '#app/schema/artboard' -import { prisma } from '#app/utils/db.server' -import { type IArtboardBranchWithVersions } from './artboard-branch/artboard-branch.server' -import { type IDesignWithType } from './design.server' -import { type ILayerWithDesigns } from './layer.server' -import { type IProjectWithArtboards } from './project/project.server' - -// Omitting 'createdAt' and 'updatedAt' from the Artboard interface -// prisma query returns a string for these fields -type BaseArtboard = Omit - -export interface IArtboard extends BaseArtboard { - createdAt: DateOrString - updatedAt: DateOrString -} -export interface IArtboardWithProject extends IArtboard { - project: IProjectWithArtboards -} -export interface IArtboardWithDesignsAndLayers extends IArtboard { - designs: IDesignWithType[] - layers: ILayerWithDesigns[] -} -export interface IArtboardWithBranchesAndVersions extends IArtboard { - branches: IArtboardBranchWithVersions[] -} - -export type PickedArtboardType = { - id: string - name: string - description: string | null - slug: string - width: number - height: number - backgroundColor: string - updatedAt: Date | string - project: { - id: string - name: string - slug: string - } -} - -// use prisma extension to .save() or .delete() - -export const findFirstArtboard = async ({ - where, - select, -}: findArtboardArgsType): Promise => { - return await prisma.artboard.findFirst({ - where, - select, - }) -} - -export const findArtboardByIdAndOwner = async ({ - id, - ownerId, - select, -}: { - id: whereArgsType['id'] - ownerId: whereArgsType['ownerId'] - select?: selectArgsType -}): Promise => { - const where = { id, ownerId } - return await findFirstArtboard({ where, select }) -} diff --git a/app/models/artboard/artboard.get.server.ts b/app/models/artboard/artboard.get.server.ts index f38d0632..dbcde332 100644 --- a/app/models/artboard/artboard.get.server.ts +++ b/app/models/artboard/artboard.get.server.ts @@ -4,7 +4,7 @@ import { type IArtboard, type IArtboardWithBranchesAndVersions, type IArtboardWithDesignsAndLayers, -} from '../artboard.server' +} from '../artboard/artboard.server' export type queryArtboardWhereArgsType = z.infer const whereArgs = z.object({ diff --git a/app/models/artboard/artboard.server.ts b/app/models/artboard/artboard.server.ts new file mode 100644 index 00000000..381d8649 --- /dev/null +++ b/app/models/artboard/artboard.server.ts @@ -0,0 +1,25 @@ +import { type Artboard } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' +import { type IArtboardBranchWithVersions } from '../artboard-branch/artboard-branch.server' +import { type IDesignWithType } from '../design/design.server' +import { type ILayerWithDesigns } from '../layer/layer.server' +import { type IProjectWithArtboards } from '../project/project.server' + +// Omitting 'createdAt' and 'updatedAt' from the Artboard interface +// prisma query returns a string for these fields +type BaseArtboard = Omit + +export interface IArtboard extends BaseArtboard { + createdAt: DateOrString + updatedAt: DateOrString +} +export interface IArtboardWithProject extends IArtboard { + project: IProjectWithArtboards +} +export interface IArtboardWithDesignsAndLayers extends IArtboard { + designs: IDesignWithType[] + layers: ILayerWithDesigns[] +} +export interface IArtboardWithBranchesAndVersions extends IArtboard { + branches: IArtboardBranchWithVersions[] +} diff --git a/app/models/design-artboard-version/design-artboard-version.get.server.ts b/app/models/design-artboard-version/design-artboard-version.get.server.ts index b23d7d9b..7312122e 100644 --- a/app/models/design-artboard-version/design-artboard-version.get.server.ts +++ b/app/models/design-artboard-version/design-artboard-version.get.server.ts @@ -2,7 +2,7 @@ import { type designTypeEnum } from '#app/schema/design' import { prisma } from '#app/utils/db.server' import { orderLinkedItems } from '#app/utils/linked-list.utils' import { type IArtboardVersion } from '../artboard-version/artboard-version.server' -import { type IDesign } from '../design.server' +import { type IDesign } from '../design/design.server' export const findFirstVisibleArtboardVersionDesignByType = async ({ artboardVersionId, diff --git a/app/models/design-artboard-version.server.ts b/app/models/design-artboard-version/design-artboard-version.server.ts similarity index 90% rename from app/models/design-artboard-version.server.ts rename to app/models/design-artboard-version/design-artboard-version.server.ts index 876235ea..824b3fc4 100644 --- a/app/models/design-artboard-version.server.ts +++ b/app/models/design-artboard-version/design-artboard-version.server.ts @@ -4,15 +4,15 @@ import { prisma } from '#app/utils/db.server' import { filterVisibleDesigns } from '#app/utils/design' import { orderLinkedItems } from '#app/utils/linked-list.utils' import { filterNonArrayRotates } from '#app/utils/rotate' -import { type IArtboardVersion } from './artboard-version/artboard-version.server' +import { type IArtboardVersion } from '../artboard-version/artboard-version.server' import { findManyDesignsWithType, type IDesignWithPalette, type IDesign, type IDesignWithRotate, -} from './design.server' -import { type IPalette } from './palette.server' -import { type IRotate } from './rotate.server' +} from '../design/design.server' +import { type IPalette } from '../design-type/palette/palette.server' +import { type IRotate } from '../design-type/rotate/rotate.server' export interface IDesignWithArtboardVersion extends IDesign { artboardVersion: IArtboardVersion diff --git a/app/models/design-artboard.server.ts b/app/models/design-artboard.server.ts index 0b5b0c0c..a1434a9a 100644 --- a/app/models/design-artboard.server.ts +++ b/app/models/design-artboard.server.ts @@ -4,15 +4,17 @@ import { prisma } from '#app/utils/db.server' import { filterVisibleDesigns } from '#app/utils/design' import { orderLinkedItems } from '#app/utils/linked-list.utils' import { filterNonArrayRotates } from '#app/utils/rotate' -import { type IArtboard } from './artboard.server' +import { type IArtboard } from './artboard/artboard.server' import { findManyDesignsWithType, type IDesignWithPalette, type IDesign, type IDesignWithRotate, -} from './design.server' -import { type IPalette } from './palette.server' -import { type IRotate } from './rotate.server' +} from './design/design.server' +import { type IPalette } from './design-type/palette/palette.server' +import { type IRotate } from './design-type/rotate/rotate.server' + +// this file may no longer be necessary export interface IDesignWithArtboard extends IDesign { artboard: IArtboard diff --git a/app/models/design-layer/design-layer.get.server.ts b/app/models/design-layer/design-layer.get.server.ts index b9f28b29..1d6a74cf 100644 --- a/app/models/design-layer/design-layer.get.server.ts +++ b/app/models/design-layer/design-layer.get.server.ts @@ -1,8 +1,8 @@ import { type designTypeEnum } from '#app/schema/design' import { prisma } from '#app/utils/db.server' import { orderLinkedItems } from '#app/utils/linked-list.utils' -import { type IDesign } from '../design.server' -import { type ILayer } from '../layer.server' +import { type IDesign } from '../design/design.server' +import { type ILayer } from '../layer/layer.server' export const findFirstVisibleLayerDesignByType = async ({ layerId, diff --git a/app/models/design-layer.server.ts b/app/models/design-layer/design-layer.server.ts similarity index 90% rename from app/models/design-layer.server.ts rename to app/models/design-layer/design-layer.server.ts index 88a8d416..32afef16 100644 --- a/app/models/design-layer.server.ts +++ b/app/models/design-layer/design-layer.server.ts @@ -9,10 +9,10 @@ import { type IDesignWithPalette, type IDesign, type IDesignWithRotate, -} from './design.server' -import { type ILayer } from './layer.server' -import { type IPalette } from './palette.server' -import { type IRotate } from './rotate.server' +} from '../design/design.server' +import { type IPalette } from '../design-type/palette/palette.server' +import { type IRotate } from '../design-type/rotate/rotate.server' +import { type ILayer } from '../layer/layer.server' export interface IDesignWithLayer extends IDesign { layer: ILayer diff --git a/app/models/fill.server.ts b/app/models/design-type/fill/fill.create.server.ts similarity index 56% rename from app/models/fill.server.ts rename to app/models/design-type/fill/fill.create.server.ts index ced3d14d..7eefca21 100644 --- a/app/models/fill.server.ts +++ b/app/models/design-type/fill/fill.create.server.ts @@ -1,21 +1,9 @@ -import { FillDataSchema } from '#app/schema/fill' -import { prisma } from '#app/utils/db.server' import { - type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithFill, - type IDesignWithType, -} from './design.server' - -export interface IFill { - id: string - style: string - value: string - basis: string - createdAt: Date | string - updatedAt: Date | string - designId: string -} + type IDesign, +} from '#app/models/design/design.server' +import { FillDataSchema } from '#app/schema/fill' +import { prisma } from '#app/utils/db.server' export interface IFillCreateOverrides { style?: string @@ -23,16 +11,6 @@ export interface IFillCreateOverrides { basis?: string } -export const findFirstFillInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): IFill | null => { - const design = designs.find(design => design.fill) as IDesignWithFill - - return design?.fill || null -} - export const createDesignFill = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/fill/fill.get.server.ts b/app/models/design-type/fill/fill.get.server.ts new file mode 100644 index 00000000..b9a5a3e4 --- /dev/null +++ b/app/models/design-type/fill/fill.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithFill, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type IFill } from './fill.server' + +export const findFirstFillInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): IFill | null => { + const design = designs.find(design => design.fill) as IDesignWithFill + + return design?.fill || null +} diff --git a/app/models/design-type/fill/fill.server.ts b/app/models/design-type/fill/fill.server.ts new file mode 100644 index 00000000..6852559e --- /dev/null +++ b/app/models/design-type/fill/fill.server.ts @@ -0,0 +1,11 @@ +import { type Fill } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface IFill extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.fill.server.ts b/app/models/design-type/fill/fill.update.server.ts similarity index 97% rename from app/models/design-type/design-type.update.fill.server.ts rename to app/models/design-type/fill/fill.update.server.ts index ad2bf1da..c8119cee 100644 --- a/app/models/design-type/design-type.update.fill.server.ts +++ b/app/models/design-type/fill/fill.update.server.ts @@ -8,8 +8,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstFillInstance } from '#app/utils/prisma-extensions-fill' -import { type IDesign } from '../design.server' -import { type IFill } from '../fill.server' +import { type IDesign } from '../../design/design.server' +import { type IFill } from './fill.server' export interface IDesignTypeFillUpdatedResponse { success: boolean diff --git a/app/models/layout.server.ts b/app/models/design-type/layout/layout.create.server.ts similarity index 56% rename from app/models/layout.server.ts rename to app/models/design-type/layout/layout.create.server.ts index 2c43da67..150dfdd7 100644 --- a/app/models/layout.server.ts +++ b/app/models/design-type/layout/layout.create.server.ts @@ -1,22 +1,9 @@ -import { LayoutDataSchema } from '#app/schema/layout' -import { prisma } from '#app/utils/db.server' import { type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithLayout, - type IDesignWithType, -} from './design.server' - -export interface ILayout { - id: string - style: string - count: number - rows: number - columns: number - createdAt: Date | string - updatedAt: Date | string - designId: string -} +} from '#app/models/design/design.server' +import { LayoutDataSchema } from '#app/schema/layout' +import { prisma } from '#app/utils/db.server' export interface ILayoutCreateOverrides { style?: string @@ -25,16 +12,6 @@ export interface ILayoutCreateOverrides { columns?: number } -export const findFirstLayoutInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): ILayout | null => { - const design = designs.find(design => design.layout) as IDesignWithLayout - - return design?.layout || null -} - export const createDesignLayout = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/layout/layout.get.server.ts b/app/models/design-type/layout/layout.get.server.ts new file mode 100644 index 00000000..a3031caf --- /dev/null +++ b/app/models/design-type/layout/layout.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithLayout, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type ILayout } from './layout.server' + +export const findFirstLayoutInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): ILayout | null => { + const design = designs.find(design => design.layout) as IDesignWithLayout + + return design?.layout || null +} diff --git a/app/models/design-type/layout/layout.server.ts b/app/models/design-type/layout/layout.server.ts new file mode 100644 index 00000000..af003216 --- /dev/null +++ b/app/models/design-type/layout/layout.server.ts @@ -0,0 +1,11 @@ +import { type Layout } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface ILayout extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.layout.server.ts b/app/models/design-type/layout/layout.update.server.ts similarity index 98% rename from app/models/design-type/design-type.update.layout.server.ts rename to app/models/design-type/layout/layout.update.server.ts index d124aa0d..15a5918a 100644 --- a/app/models/design-type/design-type.update.layout.server.ts +++ b/app/models/design-type/layout/layout.update.server.ts @@ -9,8 +9,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstLayoutInstance } from '#app/utils/prisma-extensions-layout' -import { type IDesign } from '../design.server' -import { type ILayout } from '../layout.server' +import { type IDesign } from '../../design/design.server' +import { type ILayout } from './layout.server' export interface IDesignTypeLayoutUpdatedResponse { success: boolean diff --git a/app/models/line.server.ts b/app/models/design-type/line/line.create.server.ts similarity index 55% rename from app/models/line.server.ts rename to app/models/design-type/line/line.create.server.ts index 1e42815a..9c496906 100644 --- a/app/models/line.server.ts +++ b/app/models/design-type/line/line.create.server.ts @@ -1,36 +1,14 @@ -import { LineDataSchema } from '#app/schema/line' -import { prisma } from '#app/utils/db.server' import { type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithLine, - type IDesignWithType, -} from './design.server' - -export interface ILine { - id: string - width: number - basis: string - format: string - createdAt: Date | string - updatedAt: Date | string - designId: string -} +} from '#app/models/design/design.server' +import { LineDataSchema } from '#app/schema/line' +import { prisma } from '#app/utils/db.server' export interface ILineCreateOverrides { width?: number } -export const findFirstLineInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): ILine | null => { - const design = designs.find(design => design.line) as IDesignWithLine - - return design?.line || null -} - export const createDesignLine = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/line/line.get.server.ts b/app/models/design-type/line/line.get.server.ts new file mode 100644 index 00000000..21b070ca --- /dev/null +++ b/app/models/design-type/line/line.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithLine, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type ILine } from './line.server' + +export const findFirstLineInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): ILine | null => { + const design = designs.find(design => design.line) as IDesignWithLine + + return design?.line || null +} diff --git a/app/models/design-type/line/line.server.ts b/app/models/design-type/line/line.server.ts new file mode 100644 index 00000000..bf58c6cb --- /dev/null +++ b/app/models/design-type/line/line.server.ts @@ -0,0 +1,11 @@ +import { type Line } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface ILine extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.line.server.ts b/app/models/design-type/line/line.update.server.ts similarity index 97% rename from app/models/design-type/design-type.update.line.server.ts rename to app/models/design-type/line/line.update.server.ts index d23a9132..ff1b69d8 100644 --- a/app/models/design-type/design-type.update.line.server.ts +++ b/app/models/design-type/line/line.update.server.ts @@ -8,8 +8,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstLineInstance } from '#app/utils/prisma-extensions-line' -import { type IDesign } from '../design.server' -import { type ILine } from '../line.server' +import { type IDesign } from '../../design/design.server' +import { type ILine } from './line.server' export interface IDesignTypeLineUpdatedResponse { success: boolean diff --git a/app/models/palette.server.ts b/app/models/design-type/palette/palette.create.server.ts similarity index 56% rename from app/models/palette.server.ts rename to app/models/design-type/palette/palette.create.server.ts index 4e541380..f665b1f4 100644 --- a/app/models/palette.server.ts +++ b/app/models/design-type/palette/palette.create.server.ts @@ -1,21 +1,9 @@ -import { PaletteDataSchema } from '#app/schema/palette' -import { prisma } from '#app/utils/db.server' import { - type IDesignTypeCreateOverrides, type IDesign, - type IDesignWithPalette, - type IDesignWithType, -} from './design.server' - -export interface IPalette { - id: string - format: string - value: string - opacity: number - createdAt: Date | string - updatedAt: Date | string - designId: string -} + type IDesignTypeCreateOverrides, +} from '#app/models/design/design.server' +import { PaletteDataSchema } from '#app/schema/palette' +import { prisma } from '#app/utils/db.server' export interface IPaletteCreateOverrides { format?: string @@ -23,16 +11,6 @@ export interface IPaletteCreateOverrides { opacity?: number } -export const findFirstPaletteInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): IPalette | null => { - const design = designs.find(design => design.palette) as IDesignWithPalette - - return design?.palette || null -} - export const createDesignPalette = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/palette/palette.get.server.ts b/app/models/design-type/palette/palette.get.server.ts new file mode 100644 index 00000000..a2998f1a --- /dev/null +++ b/app/models/design-type/palette/palette.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithPalette, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type IPalette } from './palette.server' + +export const findFirstPaletteInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): IPalette | null => { + const design = designs.find(design => design.palette) as IDesignWithPalette + + return design?.palette || null +} diff --git a/app/models/design-type/palette/palette.server.ts b/app/models/design-type/palette/palette.server.ts new file mode 100644 index 00000000..e0397a73 --- /dev/null +++ b/app/models/design-type/palette/palette.server.ts @@ -0,0 +1,11 @@ +import { type Palette } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface IPalette extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.palette.server.ts b/app/models/design-type/palette/palette.update.server.ts similarity index 95% rename from app/models/design-type/design-type.update.palette.server.ts rename to app/models/design-type/palette/palette.update.server.ts index b30a571b..8bdc49be 100644 --- a/app/models/design-type/design-type.update.palette.server.ts +++ b/app/models/design-type/palette/palette.update.server.ts @@ -6,8 +6,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstPaletteInstance } from '#app/utils/prisma-extensions-palette' -import { type IDesign } from '../design.server' -import { type IPalette } from '../palette.server' +import { type IDesign } from '../../design/design.server' +import { type IPalette } from './palette.server' export interface IDesignTypePaletteUpdatedResponse { success: boolean diff --git a/app/models/rotate.server.ts b/app/models/design-type/rotate/rotate.create.server.ts similarity index 56% rename from app/models/rotate.server.ts rename to app/models/design-type/rotate/rotate.create.server.ts index 3bdd6d0a..74cae07b 100644 --- a/app/models/rotate.server.ts +++ b/app/models/design-type/rotate/rotate.create.server.ts @@ -1,36 +1,15 @@ -import { RotateDataSchema } from '#app/schema/rotate' -import { prisma } from '#app/utils/db.server' import { type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithRotate, - type IDesignWithType, -} from './design.server' - -export interface IRotate { - id: string - value: number - basis: string - createdAt: Date | string - updatedAt: Date | string - designId: string -} +} from '#app/models/design/design.server' +import { RotateDataSchema } from '#app/schema/rotate' +import { prisma } from '#app/utils/db.server' export interface IRotateCreateOverrides { value?: number basis?: string } -export const findFirstRotateInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): IRotate | null => { - const design = designs.find(design => design.rotate) as IDesignWithRotate - - return design?.rotate || null -} - export const createDesignRotate = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/rotate/rotate.get.server.ts b/app/models/design-type/rotate/rotate.get.server.ts new file mode 100644 index 00000000..759b07bf --- /dev/null +++ b/app/models/design-type/rotate/rotate.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithRotate, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type IRotate } from './rotate.server' + +export const findFirstRotateInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): IRotate | null => { + const design = designs.find(design => design.rotate) as IDesignWithRotate + + return design?.rotate || null +} diff --git a/app/models/design-type/rotate/rotate.server.ts b/app/models/design-type/rotate/rotate.server.ts new file mode 100644 index 00000000..3c7c9ecf --- /dev/null +++ b/app/models/design-type/rotate/rotate.server.ts @@ -0,0 +1,11 @@ +import { type Rotate } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface IRotate extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.rotate.server.ts b/app/models/design-type/rotate/rotate.update.server.ts similarity index 96% rename from app/models/design-type/design-type.update.rotate.server.ts rename to app/models/design-type/rotate/rotate.update.server.ts index 34f7e0c1..fe217b06 100644 --- a/app/models/design-type/design-type.update.rotate.server.ts +++ b/app/models/design-type/rotate/rotate.update.server.ts @@ -7,8 +7,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstRotateInstance } from '#app/utils/prisma-extensions-rotate' -import { type IDesign } from '../design.server' -import { type IRotate } from '../rotate.server' +import { type IDesign } from '../../design/design.server' +import { type IRotate } from './rotate.server' export interface IDesignTypeRotateUpdatedResponse { success: boolean diff --git a/app/models/size.server.ts b/app/models/design-type/size/size.create.server.ts similarity index 56% rename from app/models/size.server.ts rename to app/models/design-type/size/size.create.server.ts index 1f70bb0d..cd1a17dc 100644 --- a/app/models/size.server.ts +++ b/app/models/design-type/size/size.create.server.ts @@ -1,21 +1,9 @@ -import { SizeDataSchema } from '#app/schema/size' -import { prisma } from '#app/utils/db.server' import { type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithSize, - type IDesignWithType, -} from './design.server' - -export interface ISize { - id: string - format: string - value: number - basis: string - createdAt: Date | string - updatedAt: Date | string - designId: string -} +} from '#app/models/design/design.server' +import { SizeDataSchema } from '#app/schema/size' +import { prisma } from '#app/utils/db.server' export interface ISizeCreateOverrides { format?: string @@ -23,16 +11,6 @@ export interface ISizeCreateOverrides { basis?: string } -export const findFirstSizeInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): ISize | null => { - const design = designs.find(design => design.size) as IDesignWithSize - - return design?.size || null -} - export const createDesignSize = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/size/size.get.server.ts b/app/models/design-type/size/size.get.server.ts new file mode 100644 index 00000000..184222c3 --- /dev/null +++ b/app/models/design-type/size/size.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithSize, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type ISize } from './size.server' + +export const findFirstSizeInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): ISize | null => { + const design = designs.find(design => design.size) as IDesignWithSize + + return design?.size || null +} diff --git a/app/models/design-type/size/size.server.ts b/app/models/design-type/size/size.server.ts new file mode 100644 index 00000000..29900b8b --- /dev/null +++ b/app/models/design-type/size/size.server.ts @@ -0,0 +1,11 @@ +import { type Size } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface ISize extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.size.server.ts b/app/models/design-type/size/size.update.server.ts similarity index 97% rename from app/models/design-type/design-type.update.size.server.ts rename to app/models/design-type/size/size.update.server.ts index 7cbd57ba..66af79e0 100644 --- a/app/models/design-type/design-type.update.size.server.ts +++ b/app/models/design-type/size/size.update.server.ts @@ -8,8 +8,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstSizeInstance } from '#app/utils/prisma-extensions-size' -import { type IDesign } from '../design.server' -import { type ISize } from '../size.server' +import { type IDesign } from '../../design/design.server' +import { type ISize } from './size.server' export interface IDesignTypeSizeUpdatedResponse { success: boolean diff --git a/app/models/stroke.server.ts b/app/models/design-type/stroke/stroke.create.server.ts similarity index 56% rename from app/models/stroke.server.ts rename to app/models/design-type/stroke/stroke.create.server.ts index c2901b4e..4c587209 100644 --- a/app/models/stroke.server.ts +++ b/app/models/design-type/stroke/stroke.create.server.ts @@ -1,21 +1,9 @@ -import { StrokeDataSchema } from '#app/schema/stroke' -import { prisma } from '#app/utils/db.server' import { type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithStroke, - type IDesignWithType, -} from './design.server' - -export interface IStroke { - id: string - style: string - value: string - basis: string - createdAt: Date | string - updatedAt: Date | string - designId: string -} +} from '#app/models/design/design.server' +import { StrokeDataSchema } from '#app/schema/stroke' +import { prisma } from '#app/utils/db.server' export interface IStrokeCreateOverrides { style?: string @@ -23,16 +11,6 @@ export interface IStrokeCreateOverrides { basis?: string } -export const findFirstStrokeInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): IStroke | null => { - const design = designs.find(design => design.stroke) as IDesignWithStroke - - return design?.stroke || null -} - export const createDesignStroke = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/stroke/stroke.get.server.ts b/app/models/design-type/stroke/stroke.get.server.ts new file mode 100644 index 00000000..909031b5 --- /dev/null +++ b/app/models/design-type/stroke/stroke.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithStroke, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type IStroke } from './stroke.server' + +export const findFirstStrokeInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): IStroke | null => { + const design = designs.find(design => design.stroke) as IDesignWithStroke + + return design?.stroke || null +} diff --git a/app/models/design-type/stroke/stroke.server.ts b/app/models/design-type/stroke/stroke.server.ts new file mode 100644 index 00000000..c6773838 --- /dev/null +++ b/app/models/design-type/stroke/stroke.server.ts @@ -0,0 +1,11 @@ +import { type Stroke } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface IStroke extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.stroke.server.ts b/app/models/design-type/stroke/stroke.update.server.ts similarity index 97% rename from app/models/design-type/design-type.update.stroke.server.ts rename to app/models/design-type/stroke/stroke.update.server.ts index 7324a443..617a0c16 100644 --- a/app/models/design-type/design-type.update.stroke.server.ts +++ b/app/models/design-type/stroke/stroke.update.server.ts @@ -8,8 +8,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstStrokeInstance } from '#app/utils/prisma-extensions-stroke' -import { type IDesign } from '../design.server' -import { type IStroke } from '../stroke.server' +import { type IDesign } from '../../design/design.server' +import { type IStroke } from './stroke.server' export interface IDesignTypeStrokeUpdatedResponse { success: boolean diff --git a/app/models/template.server.ts b/app/models/design-type/template/template.create.server.ts similarity index 56% rename from app/models/template.server.ts rename to app/models/design-type/template/template.create.server.ts index 10d4293c..f317b909 100644 --- a/app/models/template.server.ts +++ b/app/models/design-type/template/template.create.server.ts @@ -1,34 +1,14 @@ -import { TemplateDataSchema } from '#app/schema/template' -import { prisma } from '#app/utils/db.server' import { type IDesign, type IDesignTypeCreateOverrides, - type IDesignWithTemplate, - type IDesignWithType, -} from './design.server' - -export interface ITemplate { - id: string - style: string - createdAt: Date | string - updatedAt: Date | string - designId: string -} +} from '#app/models/design/design.server' +import { TemplateDataSchema } from '#app/schema/template' +import { prisma } from '#app/utils/db.server' export interface ITemplateCreateOverrides { style?: string } -export const findFirstTemplateInDesignArray = ({ - designs, -}: { - designs: IDesignWithType[] -}): ITemplate | null => { - const design = designs.find(design => design.template) as IDesignWithTemplate - - return design?.template || null -} - export const createDesignTemplate = ({ designId, designTypeOverrides, diff --git a/app/models/design-type/template/template.get.server.ts b/app/models/design-type/template/template.get.server.ts new file mode 100644 index 00000000..8354ffd3 --- /dev/null +++ b/app/models/design-type/template/template.get.server.ts @@ -0,0 +1,15 @@ +import { + type IDesignWithTemplate, + type IDesignWithType, +} from '#app/models/design/design.server' +import { type ITemplate } from './template.server' + +export const findFirstTemplateInDesignArray = ({ + designs, +}: { + designs: IDesignWithType[] +}): ITemplate | null => { + const design = designs.find(design => design.template) as IDesignWithTemplate + + return design?.template || null +} diff --git a/app/models/design-type/template/template.server.ts b/app/models/design-type/template/template.server.ts new file mode 100644 index 00000000..c5b0046f --- /dev/null +++ b/app/models/design-type/template/template.server.ts @@ -0,0 +1,11 @@ +import { type Template } from '@prisma/client' +import { type DateOrString } from '#app/definitions/prisma-helper' + +// Omitting 'createdAt' and 'updatedAt' from the Base interface +// prisma query returns a string for these fields +type Base = Omit + +export interface ITemplate extends Base { + createdAt: DateOrString + updatedAt: DateOrString +} diff --git a/app/models/design-type/design-type.update.template.server.ts b/app/models/design-type/template/template.update.server.ts similarity index 95% rename from app/models/design-type/design-type.update.template.server.ts rename to app/models/design-type/template/template.update.server.ts index 91bbd51a..891f43c1 100644 --- a/app/models/design-type/design-type.update.template.server.ts +++ b/app/models/design-type/template/template.update.server.ts @@ -6,8 +6,8 @@ import { import { ValidateDesignParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstTemplateInstance } from '#app/utils/prisma-extensions-template' -import { type IDesign } from '../design.server' -import { type ITemplate } from '../template.server' +import { type IDesign } from '../../design/design.server' +import { type ITemplate } from './template.server' export interface IDesignTypeTemplateUpdatedResponse { success: boolean diff --git a/app/models/design/design.create.server.ts b/app/models/design/design.create.server.ts index 9f1af375..572a611d 100644 --- a/app/models/design/design.create.server.ts +++ b/app/models/design/design.create.server.ts @@ -2,10 +2,10 @@ import { type User } from '@prisma/client' import { type designTypeEnum } from '#app/schema/design' import { NewArtboardVersionDesignSchema } from '#app/schema/design-artboard-version' import { prisma } from '#app/utils/db.server' +import { type IArtboard } from '../artboard/artboard.server' import { type IArtboardVersion } from '../artboard-version/artboard-version.server' -import { type IArtboard } from '../artboard.server' -import { type IDesign } from '../design.server' -import { type ILayer } from '../layer.server' +import { type IDesign } from '../design/design.server' +import { type ILayer } from '../layer/layer.server' export interface IDesignCreatedResponse { success: boolean diff --git a/app/models/design/design.delete.server.ts b/app/models/design/design.delete.server.ts index 018f1eda..77dd2b14 100644 --- a/app/models/design/design.delete.server.ts +++ b/app/models/design/design.delete.server.ts @@ -1,5 +1,5 @@ import { prisma } from '#app/utils/db.server' -import { type IDesign } from '../design.server' +import { type IDesign } from '../design/design.server' export interface IDesignDeletedResponse { success: boolean diff --git a/app/models/design/design.get.server.ts b/app/models/design/design.get.server.ts index 7d2f4db7..071ce2c5 100644 --- a/app/models/design/design.get.server.ts +++ b/app/models/design/design.get.server.ts @@ -2,7 +2,7 @@ import { z } from 'zod' import { DesignTypeEnum } from '#app/schema/design' import { zodStringOrNull } from '#app/schema/zod-helpers' import { prisma } from '#app/utils/db.server' -import { type IDesign, type IDesignWithType } from '../design.server' +import { type IDesign, type IDesignWithType } from '../design/design.server' export type queryDesignWhereArgsType = z.infer const whereArgs = z.object({ diff --git a/app/models/design.server.ts b/app/models/design/design.server.ts similarity index 78% rename from app/models/design.server.ts rename to app/models/design/design.server.ts index 0755c114..c899d8ae 100644 --- a/app/models/design.server.ts +++ b/app/models/design/design.server.ts @@ -5,22 +5,27 @@ import { type whereArgsType, } from '#app/schema/design' import { prisma } from '#app/utils/db.server' +import { type IArtboard } from '../artboard/artboard.server' import { type IArtboardVersionWithDesignsAndLayers, type IArtboardVersion, -} from './artboard-version/artboard-version.server' -import { type IArtboard } from './artboard.server' -import { type IFillCreateOverrides, type IFill } from './fill.server' -import { type ILayoutCreateOverrides, type ILayout } from './layout.server' -import { type ILineCreateOverrides, type ILine } from './line.server' -import { type IPaletteCreateOverrides, type IPalette } from './palette.server' -import { type IRotateCreateOverrides, type IRotate } from './rotate.server' -import { type ISizeCreateOverrides, type ISize } from './size.server' -import { type IStrokeCreateOverrides, type IStroke } from './stroke.server' -import { - type ITemplateCreateOverrides, - type ITemplate, -} from './template.server' +} from '../artboard-version/artboard-version.server' +import { type IFillCreateOverrides } from '../design-type/fill/fill.create.server' +import { type IFill } from '../design-type/fill/fill.server' +import { type ILayoutCreateOverrides } from '../design-type/layout/layout.create.server' +import { type ILayout } from '../design-type/layout/layout.server' +import { type ILineCreateOverrides } from '../design-type/line/line.create.server' +import { type ILine } from '../design-type/line/line.server' +import { type IPaletteCreateOverrides } from '../design-type/palette/palette.create.server' +import { type IPalette } from '../design-type/palette/palette.server' +import { type IRotateCreateOverrides } from '../design-type/rotate/rotate.create.server' +import { type IRotate } from '../design-type/rotate/rotate.server' +import { type ISizeCreateOverrides } from '../design-type/size/size.create.server' +import { type ISize } from '../design-type/size/size.server' +import { type IStrokeCreateOverrides } from '../design-type/stroke/stroke.create.server' +import { type IStroke } from '../design-type/stroke/stroke.server' +import { type ITemplateCreateOverrides } from '../design-type/template/template.create.server' +import { type ITemplate } from '../design-type/template/template.server' export interface IDesign extends Design {} diff --git a/app/models/design/design.update.server.ts b/app/models/design/design.update.server.ts index cb7ea6eb..1eb74770 100644 --- a/app/models/design/design.update.server.ts +++ b/app/models/design/design.update.server.ts @@ -1,5 +1,5 @@ import { prisma } from '#app/utils/db.server' -import { type IDesign } from '../design.server' +import { type IDesign } from '../design/design.server' export interface IDesignUpdatedResponse { success: boolean diff --git a/app/models/layer-artboard-version/layer-artboard-version.update.server.ts b/app/models/layer-artboard-version/layer-artboard-version.update.server.ts index 4250f0ac..b37229a8 100644 --- a/app/models/layer-artboard-version/layer-artboard-version.update.server.ts +++ b/app/models/layer-artboard-version/layer-artboard-version.update.server.ts @@ -8,7 +8,7 @@ import { ValidateArtboardVersionParentSubmissionStrategy } from '#app/strategies import { validateEntitySubmission } from '#app/utils/conform-utils' import { prisma } from '#app/utils/db.server' import { type IArtboardVersion } from '../artboard-version/artboard-version.server' -import { type ILayer } from '../layer.server' +import { type ILayer } from '../layer/layer.server' export const validateArtboardVersionToggleVisibeLayerSubmission = async ({ userId, diff --git a/app/models/layer/layer.create.server.ts b/app/models/layer/layer.create.server.ts index 3c86be3b..a215e3da 100644 --- a/app/models/layer/layer.create.server.ts +++ b/app/models/layer/layer.create.server.ts @@ -3,9 +3,9 @@ import { NewArtboardVersionLayerSchema } from '#app/schema/layer-artboard-versio import { ValidateArtboardVersionParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { prisma } from '#app/utils/db.server' +import { type IArtboard } from '../artboard/artboard.server' import { type IArtboardVersion } from '../artboard-version/artboard-version.server' -import { type IArtboard } from '../artboard.server' -import { type ILayer } from '../layer.server' +import { type ILayer } from '../layer/layer.server' import { type IUser } from '../user/user.server' export interface ILayerCreatedResponse { diff --git a/app/models/layer/layer.delete.server.ts b/app/models/layer/layer.delete.server.ts index 85270177..93d13091 100644 --- a/app/models/layer/layer.delete.server.ts +++ b/app/models/layer/layer.delete.server.ts @@ -3,7 +3,7 @@ import { DeleteArtboardVersionLayerSchema } from '#app/schema/layer-artboard-ver import { ValidateArtboardVersionParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { prisma } from '#app/utils/db.server' -import { type ILayer } from '../layer.server' +import { type ILayer } from '../layer/layer.server' export interface ILayerDeletedResponse { success: boolean diff --git a/app/models/layer/layer.get.server.ts b/app/models/layer/layer.get.server.ts index a25e616a..e8a8b00b 100644 --- a/app/models/layer/layer.get.server.ts +++ b/app/models/layer/layer.get.server.ts @@ -1,6 +1,6 @@ import { type whereArgsType } from '#app/schema/layer' import { prisma } from '#app/utils/db.server' -import { type ILayer, type ILayerWithDesigns } from '../layer.server' +import { type ILayer, type ILayerWithDesigns } from '../layer/layer.server' export const getLayersWithDesigns = async ({ where, diff --git a/app/models/layer.server.ts b/app/models/layer/layer.server.ts similarity index 92% rename from app/models/layer.server.ts rename to app/models/layer/layer.server.ts index b29de951..a989f766 100644 --- a/app/models/layer.server.ts +++ b/app/models/layer/layer.server.ts @@ -5,9 +5,9 @@ import { type whereArgsType, } from '#app/schema/layer' import { prisma } from '#app/utils/db.server' -import { type IArtboardVersion } from './artboard-version/artboard-version.server' -import { type IArtboard } from './artboard.server' -import { type IDesignWithType } from './design.server' +import { type IArtboard } from '../artboard/artboard.server' +import { type IArtboardVersion } from '../artboard-version/artboard-version.server' +import { type IDesignWithType } from '../design/design.server' export interface ILayer { id: string diff --git a/app/models/layer/layer.update.server.ts b/app/models/layer/layer.update.server.ts index 0d94b860..97051121 100644 --- a/app/models/layer/layer.update.server.ts +++ b/app/models/layer/layer.update.server.ts @@ -6,7 +6,7 @@ import { import { ValidateLayerSubmissionStrategy } from '#app/strategies/validate-submission.strategy' import { validateEntitySubmission } from '#app/utils/conform-utils' import { findFirstLayerInstance } from '#app/utils/prisma-extensions-layer' -import { type ILayer } from '../layer.server' +import { type ILayer } from '../layer/layer.server' export interface ILayerUpdatedResponse { success: boolean diff --git a/app/models/project/project.server.ts b/app/models/project/project.server.ts index f2493610..6bf22944 100644 --- a/app/models/project/project.server.ts +++ b/app/models/project/project.server.ts @@ -1,6 +1,6 @@ import { type Project } from '@prisma/client' import { type DateOrString } from '#app/definitions/prisma-helper' -import { type IArtboard } from '../artboard.server' +import { type IArtboard } from '../artboard/artboard.server' // Omitting 'createdAt' and 'updatedAt' from the Project interface // prisma query returns a string for these fields diff --git a/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx index 057b0f89..b472177a 100644 --- a/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx +++ b/app/routes/resources+/api.v1+/design.type.fill.update.basis.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeFillBasis, validateDesignTypeUpdateFillBasisSubmission, -} from '#app/models/design-type/design-type.update.fill.server' +} from '#app/models/design-type/fill/fill.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx b/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx index 4cfe66cc..e4a40860 100644 --- a/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx +++ b/app/routes/resources+/api.v1+/design.type.fill.update.style.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeFillStyle, validateDesignTypeUpdateFillStyleSubmission, -} from '#app/models/design-type/design-type.update.fill.server' +} from '#app/models/design-type/fill/fill.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx b/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx index 1eb2a506..00a734ea 100644 --- a/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx +++ b/app/routes/resources+/api.v1+/design.type.fill.update.value.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeFillValue, validateDesignTypeUpdateFillValueSubmission, -} from '#app/models/design-type/design-type.update.fill.server' +} from '#app/models/design-type/fill/fill.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx index 635a6f81..20ab1aa0 100644 --- a/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx +++ b/app/routes/resources+/api.v1+/design.type.layout.update.columns.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeLayoutColumns, validateDesignTypeUpdateLayoutColumnsSubmission, -} from '#app/models/design-type/design-type.update.layout.server' +} from '#app/models/design-type/layout/layout.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx index 5e5911a5..67b166cb 100644 --- a/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx +++ b/app/routes/resources+/api.v1+/design.type.layout.update.count.tsx @@ -4,7 +4,7 @@ import { type DataFunctionArgs, } from '@remix-run/node' import { redirectBack } from 'remix-utils/redirect-back' -import { validateDesignTypeUpdateLayoutCountSubmission } from '#app/models/design-type/design-type.update.layout.server' +import { validateDesignTypeUpdateLayoutCountSubmission } from '#app/models/design-type/layout/layout.update.server' import { validateNoJS } from '#app/schema/form-data' import { updateDesignTypeLayoutCountService } from '#app/services/design-type/update-layout.service' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx index 67748be5..66b1a381 100644 --- a/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx +++ b/app/routes/resources+/api.v1+/design.type.layout.update.rows.tsx @@ -4,7 +4,7 @@ import { type DataFunctionArgs, } from '@remix-run/node' import { redirectBack } from 'remix-utils/redirect-back' -import { validateDesignTypeUpdateLayoutRowsSubmission } from '#app/models/design-type/design-type.update.layout.server' +import { validateDesignTypeUpdateLayoutRowsSubmission } from '#app/models/design-type/layout/layout.update.server' import { validateNoJS } from '#app/schema/form-data' import { updateDesignTypeLayoutRowsService } from '#app/services/design-type/update-layout.service' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx b/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx index ab22083e..3c109cd5 100644 --- a/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx +++ b/app/routes/resources+/api.v1+/design.type.layout.update.style.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeLayoutStyle, validateDesignTypeUpdateLayoutStyleSubmission, -} from '#app/models/design-type/design-type.update.layout.server' +} from '#app/models/design-type/layout/layout.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx index ce29a906..a1918988 100644 --- a/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx +++ b/app/routes/resources+/api.v1+/design.type.line.update.basis.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeLineBasis, validateDesignTypeUpdateLineBasisSubmission, -} from '#app/models/design-type/design-type.update.line.server' +} from '#app/models/design-type/line/line.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.line.update.format.tsx b/app/routes/resources+/api.v1+/design.type.line.update.format.tsx index d2b6f1fb..2bd13c02 100644 --- a/app/routes/resources+/api.v1+/design.type.line.update.format.tsx +++ b/app/routes/resources+/api.v1+/design.type.line.update.format.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeLineFormat, validateDesignTypeUpdateLineFormatSubmission, -} from '#app/models/design-type/design-type.update.line.server' +} from '#app/models/design-type/line/line.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.line.update.width.tsx b/app/routes/resources+/api.v1+/design.type.line.update.width.tsx index 8eebefaa..d2758b94 100644 --- a/app/routes/resources+/api.v1+/design.type.line.update.width.tsx +++ b/app/routes/resources+/api.v1+/design.type.line.update.width.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeLineWidth, validateDesignTypeUpdateLineWidthSubmission, -} from '#app/models/design-type/design-type.update.line.server' +} from '#app/models/design-type/line/line.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx b/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx index c0e2c066..fb95725f 100644 --- a/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx +++ b/app/routes/resources+/api.v1+/design.type.palette.update.value.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypePaletteValue, validateDesignTypeUpdatePaletteValueSubmission, -} from '#app/models/design-type/design-type.update.palette.server' +} from '#app/models/design-type/palette/palette.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx index 57ac145a..0a413c8f 100644 --- a/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx +++ b/app/routes/resources+/api.v1+/design.type.rotate.update.basis.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeRotateBasis, validateDesignTypeUpdateRotateBasisSubmission, -} from '#app/models/design-type/design-type.update.rotate.server' +} from '#app/models/design-type/rotate/rotate.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx b/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx index c453b8e5..f12608f8 100644 --- a/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx +++ b/app/routes/resources+/api.v1+/design.type.rotate.update.value.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeRotateValue, validateDesignTypeUpdateRotateValueSubmission, -} from '#app/models/design-type/design-type.update.rotate.server' +} from '#app/models/design-type/rotate/rotate.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx index 6f67e6d0..5161e87b 100644 --- a/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx +++ b/app/routes/resources+/api.v1+/design.type.size.update.basis.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeSizeBasis, validateDesignTypeUpdateSizeBasisSubmission, -} from '#app/models/design-type/design-type.update.size.server' +} from '#app/models/design-type/size/size.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.size.update.format.tsx b/app/routes/resources+/api.v1+/design.type.size.update.format.tsx index a4102bc2..199ae3d5 100644 --- a/app/routes/resources+/api.v1+/design.type.size.update.format.tsx +++ b/app/routes/resources+/api.v1+/design.type.size.update.format.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeSizeFormat, validateDesignTypeUpdateSizeFormatSubmission, -} from '#app/models/design-type/design-type.update.size.server' +} from '#app/models/design-type/size/size.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.size.update.value.tsx b/app/routes/resources+/api.v1+/design.type.size.update.value.tsx index 6f413698..f0e29cdc 100644 --- a/app/routes/resources+/api.v1+/design.type.size.update.value.tsx +++ b/app/routes/resources+/api.v1+/design.type.size.update.value.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeSizeValue, validateDesignTypeUpdateSizeValueSubmission, -} from '#app/models/design-type/design-type.update.size.server' +} from '#app/models/design-type/size/size.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx b/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx index c2fd3370..fc5ead96 100644 --- a/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx +++ b/app/routes/resources+/api.v1+/design.type.stroke.update.basis.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeStrokeBasis, validateDesignTypeUpdateStrokeBasisSubmission, -} from '#app/models/design-type/design-type.update.stroke.server' +} from '#app/models/design-type/stroke/stroke.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx b/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx index d5a14faf..d94690a9 100644 --- a/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx +++ b/app/routes/resources+/api.v1+/design.type.stroke.update.style.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeStrokeStyle, validateDesignTypeUpdateStrokeStyleSubmission, -} from '#app/models/design-type/design-type.update.stroke.server' +} from '#app/models/design-type/stroke/stroke.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx b/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx index fdb4a2a8..efde5314 100644 --- a/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx +++ b/app/routes/resources+/api.v1+/design.type.stroke.update.value.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeStrokeValue, validateDesignTypeUpdateStrokeValueSubmission, -} from '#app/models/design-type/design-type.update.stroke.server' +} from '#app/models/design-type/stroke/stroke.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/resources+/api.v1+/design.type.template.update.style.tsx b/app/routes/resources+/api.v1+/design.type.template.update.style.tsx index 2ad5ffd1..44726752 100644 --- a/app/routes/resources+/api.v1+/design.type.template.update.style.tsx +++ b/app/routes/resources+/api.v1+/design.type.template.update.style.tsx @@ -7,7 +7,7 @@ import { redirectBack } from 'remix-utils/redirect-back' import { updateDesignTypeTemplateStyle, validateDesignTypeUpdateTemplateStyleSubmission, -} from '#app/models/design-type/design-type.update.template.server' +} from '#app/models/design-type/template/template.update.server' import { validateNoJS } from '#app/schema/form-data' import { requireUserId } from '#app/utils/auth.server' diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/artboard.ts b/app/routes/sketch+/artboards+/$slug_+/actions/artboard.ts index c3f340df..2b249007 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/artboard.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/artboard.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { ArtboardBackgroundColorSchema, ArtboardHeightSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-fill.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-fill.ts index 623fb8f2..533392da 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-fill.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-fill.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type IFill } from '#app/models/fill.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { EditDesignFillValueSchema, EditDesignFillBasisSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-layout.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-layout.ts index 26fb054f..f2b53348 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-layout.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-layout.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { EditDesignLayoutCountSchema, EditDesignLayoutColumnsSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-line.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-line.ts index 89d7390a..16bc3310 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-line.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-line.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type ILine } from '#app/models/line.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { EditDesignLineBasisSchema, EditDesignLineFormatSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-palette.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-palette.ts index f212e6af..6fbc445d 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-palette.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-palette.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type IPalette } from '#app/models/palette.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' import { EditDesignPaletteValueSchema } from '#app/schema/palette' import { notSubmissionResponse, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-rotate.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-rotate.ts index 9655e21b..830c7ddb 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-rotate.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-rotate.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type IRotate } from '#app/models/rotate.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { EditDesignRotateValueSchema, EditDesignRotateBasisSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-size.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-size.ts index 12297f4d..c0e20340 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-size.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-size.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { EditDesignSizeBasisSchema, EditDesignSizeFormatSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-stroke.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-stroke.ts index d08c2b53..e8c2ce92 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-stroke.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-stroke.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type IStroke } from '#app/models/stroke.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { EditDesignStrokeValueSchema, EditDesignStrokeBasisSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/design-template.ts b/app/routes/sketch+/artboards+/$slug_+/actions/design-template.ts index 4155e30d..41637382 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/design-template.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/design-template.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type ITemplate } from '#app/models/template.server' +import { type ITemplate } from '#app/models/design-type/template/template.server' import { EditDesignTemplateStyleSchema } from '#app/schema/template' import { notSubmissionResponse, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/layer.ts b/app/routes/sketch+/artboards+/$slug_+/actions/layer.ts index ba5f5b00..c99722c5 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/layer.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/layer.ts @@ -1,6 +1,6 @@ import { json } from '@remix-run/node' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { EditLayerDescriptionSchema, EditLayerNameSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/actions/utils.ts b/app/routes/sketch+/artboards+/$slug_+/actions/utils.ts index 26055bb7..f097fd74 100644 --- a/app/routes/sketch+/artboards+/$slug_+/actions/utils.ts +++ b/app/routes/sketch+/artboards+/$slug_+/actions/utils.ts @@ -1,12 +1,12 @@ import { parse } from '@conform-to/zod' import { type z } from 'zod' import { type IntentActionArgs } from '#app/definitions/intent-action-args' -import { findArtboardByIdAndOwner } from '#app/models/artboard.server' +import { getArtboard } from '#app/models/artboard/artboard.get.server' import { findDesignByIdAndOwner, findFirstDesign, -} from '#app/models/design.server' -import { findLayerByIdAndOwner } from '#app/models/layer.server' +} from '#app/models/design/design.server' +import { findLayerByIdAndOwner } from '#app/models/layer/layer.server' import { addNotFoundIssue } from '#app/utils/conform-utils' export const parseArtboardSubmission = async ({ @@ -17,7 +17,7 @@ export const parseArtboardSubmission = async ({ return await parse(formData, { schema: schema.superRefine(async (data, ctx) => { const { id } = data - const artboard = await findArtboardByIdAndOwner({ id, ownerId: userId }) + const artboard = await getArtboard({ where: { id, ownerId: userId } }) if (!artboard) ctx.addIssue(addNotFoundIssue('Artboard')) }), async: true, @@ -32,9 +32,11 @@ export const parseArtboardDesignSubmission = async ({ return await parse(formData, { schema: schema.superRefine(async (data, ctx) => { const { artboardId } = data - const artboard = await findArtboardByIdAndOwner({ - id: artboardId, - ownerId: userId, + const artboard = await getArtboard({ + where: { + id: artboardId, + ownerId: userId, + }, }) if (!artboard) ctx.addIssue(addNotFoundIssue('Artboard')) }), @@ -51,9 +53,11 @@ export const parseArtboardDesignUpdateSubmission = async ({ schema: schema.superRefine(async (data, ctx) => { const { artboardId, id } = data - const artboard = await findArtboardByIdAndOwner({ - id: artboardId, - ownerId: userId, + const artboard = await getArtboard({ + where: { + id: artboardId, + ownerId: userId, + }, }) if (!artboard) ctx.addIssue(addNotFoundIssue('Artboard')) @@ -79,9 +83,11 @@ export const parseArtboardDesignTypeSubmission = async ({ schema: schema.superRefine(async (data, ctx) => { const { artboardId, designId } = data - const artboard = await findArtboardByIdAndOwner({ - id: artboardId, - ownerId: userId, + const artboard = await getArtboard({ + where: { + id: artboardId, + ownerId: userId, + }, }) if (!artboard) ctx.addIssue(addNotFoundIssue('Artboard')) @@ -103,9 +109,11 @@ export const parseArtboardLayerSubmission = async ({ return await parse(formData, { schema: schema.superRefine(async (data, ctx) => { const { artboardId } = data - const artboard = await findArtboardByIdAndOwner({ - id: artboardId, - ownerId: userId, + const artboard = await getArtboard({ + where: { + id: artboardId, + ownerId: userId, + }, }) if (!artboard) ctx.addIssue(addNotFoundIssue('Artboard')) }), @@ -137,9 +145,11 @@ export const parseArtboardLayerUpdateSubmission = async ({ schema: schema.superRefine(async (data, ctx) => { const { artboardId, layerId } = data - const artboard = await findArtboardByIdAndOwner({ - id: artboardId, - ownerId: userId, + const artboard = await getArtboard({ + where: { + id: artboardId, + ownerId: userId, + }, }) if (!artboard) ctx.addIssue(addNotFoundIssue('Artboard')) diff --git a/app/routes/sketch+/artboards+/$slug_+/components/canvas-content.tsx b/app/routes/sketch+/artboards+/$slug_+/components/canvas-content.tsx index afcca83d..475eef2e 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/canvas-content.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/canvas-content.tsx @@ -14,7 +14,7 @@ import { type IArtboardGenerator, } from '#app/definitions/artboard-generator' import 'reactflow/dist/style.css' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { canvasDrawService } from '#app/services/canvas/draw.service' const initialNodes = [ @@ -30,7 +30,7 @@ export const CanvasContent = ({ artboard, artboardGenerator, }: { - artboard: PickedArtboardType + artboard: IArtboard artboardGenerator: IArtboardGenerator | null }) => { const { width, height, backgroundColor } = artboard diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-reorder.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-reorder.tsx index b7231deb..d1770414 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-reorder.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-reorder.tsx @@ -4,7 +4,7 @@ import { type Artboard } from '@prisma/client' import { useActionData, useFetcher } from '@remix-run/react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { PanelIconButton } from '#app/components/ui/panel-icon-button' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { ReorderArtboardLayerSchema } from '#app/schema/layer-artboard' import { useIsPending } from '#app/utils/misc' import { ARTBOARD_LAYER_INTENT } from '../../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-toggle-visible.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-toggle-visible.tsx index c983a8b5..05457955 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-toggle-visible.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/layer/panel-form-artboard-layer-toggle-visible.tsx @@ -4,7 +4,7 @@ import { type Artboard } from '@prisma/client' import { useActionData, useFetcher } from '@remix-run/react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { PanelIconButton } from '#app/components/ui/panel-icon-button' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { ToggleVisibleArtboardLayerSchema } from '#app/schema/layer-artboard' import { useIsPending } from '#app/utils/misc' import { ARTBOARD_LAYER_INTENT } from '../../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-background-color.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-background-color.tsx index 55b948eb..ddc544d5 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-background-color.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-background-color.tsx @@ -5,7 +5,7 @@ import { type ChangeEvent, type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { quickToast } from '#app/components/toaster' import { Input } from '#app/components/ui/input' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { ArtboardBackgroundColorSchema } from '#app/schema/artboard' import { stringToHexcode, validateStringIsHexcode } from '#app/utils/colors' import { useIsPending } from '#app/utils/misc' @@ -15,7 +15,7 @@ import { type action } from '../../../route' export const PanelFormArtboardEditBackgroundColor = ({ artboard, }: { - artboard: Pick + artboard: Pick }) => { const fetcher = useFetcher() diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-height.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-height.tsx index 122ea92c..3cc998a5 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-height.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-height.tsx @@ -6,7 +6,7 @@ import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Icon } from '#app/components/ui/icon' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { ArtboardHeightSchema } from '#app/schema/artboard' import { useIsPending } from '#app/utils/misc' import { ARTBOARD_INTENT } from '../../../intent' @@ -15,7 +15,7 @@ import { type action } from '../../../route' export const PanelFormArtboardEditHeight = ({ artboard, }: { - artboard: Pick + artboard: Pick }) => { const fetcher = useFetcher() diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-width.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-width.tsx index 015295f0..7073cfe5 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-width.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/artboard/panel-form-artboard-edit-width.tsx @@ -6,7 +6,7 @@ import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Icon } from '#app/components/ui/icon' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { ArtboardWidthSchema } from '#app/schema/artboard' import { useIsPending } from '#app/utils/misc' import { ARTBOARD_INTENT } from '../../../intent' @@ -15,7 +15,7 @@ import { type action } from '../../../route' export const PanelFormArtboardEditWidth = ({ artboard, }: { - artboard: Pick + artboard: Pick }) => { const fetcher = useFetcher() diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-delete.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-delete.tsx index 3200056a..dc6497e2 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-delete.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-delete.tsx @@ -3,9 +3,9 @@ import { getFieldsetConstraint } from '@conform-to/zod' import { useActionData, useFetcher } from '@remix-run/react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { PanelIconButton } from '#app/components/ui/panel-icon-button' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type DeleteDesignSchemaType } from '#app/schema/design' import { useIsPending } from '#app/utils/misc' import { type IntentDesignDelete } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-basis.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-basis.tsx index 711a63f4..2033fab0 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-basis.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-basis.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type IFill } from '#app/models/fill.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { EditDesignFillBasisSchema, FillBasisTypeEnum } from '#app/schema/fill' import { useIsPending } from '#app/utils/misc' import { DESIGN_FILL_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-style.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-style.tsx index 3981217b..20b26a72 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-style.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-style.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type IFill } from '#app/models/fill.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { EditDesignFillStyleSchema, FillStyleTypeEnum } from '#app/schema/fill' import { useIsPending } from '#app/utils/misc' import { DESIGN_FILL_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-value.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-value.tsx index 2d399759..31b5155c 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-value.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-fill-edit-value.tsx @@ -5,7 +5,7 @@ import { type ChangeEvent, type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { quickToast } from '#app/components/toaster' import { Input } from '#app/components/ui/input' -import { type IFill } from '#app/models/fill.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { EditDesignFillValueSchema } from '#app/schema/fill' import { stringToHexcode, validateStringIsHexcode } from '#app/utils/colors' import { useIsPending } from '#app/utils/misc' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-columns.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-columns.tsx index 219acdb5..2fbd61a6 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-columns.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-columns.tsx @@ -4,7 +4,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { EditDesignLayoutColumnsSchema } from '#app/schema/layout' import { useIsPending } from '#app/utils/misc' import { DESIGN_LAYOUT_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-count.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-count.tsx index 2a2eabbb..30b03eff 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-count.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-count.tsx @@ -4,7 +4,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { EditDesignLayoutCountSchema } from '#app/schema/layout' import { useIsPending } from '#app/utils/misc' import { DESIGN_LAYOUT_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-rows.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-rows.tsx index 69b2d496..f42b6fa0 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-rows.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-rows.tsx @@ -4,7 +4,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { EditDesignLayoutRowsSchema } from '#app/schema/layout' import { useIsPending } from '#app/utils/misc' import { DESIGN_LAYOUT_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-style.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-style.tsx index d879f2c8..0030960b 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-style.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-layout-edit-style.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { EditDesignLayoutStyleSchema } from '#app/schema/layout' import { useIsPending } from '#app/utils/misc' import { DESIGN_LAYOUT_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-basis.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-basis.tsx index fc2ea5bd..b764646d 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-basis.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-basis.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type ILine } from '#app/models/line.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { EditDesignLineBasisSchema, LineBasisTypeEnum } from '#app/schema/line' import { useIsPending } from '#app/utils/misc' import { DESIGN_LINE_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-format.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-format.tsx index 8913a6b9..64ec2cfb 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-format.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line-edit-format.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type ILine } from '#app/models/line.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { EditDesignLineFormatSchema, LineFormatTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line=edit-width.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line=edit-width.tsx index 7653034b..46bc8626 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line=edit-width.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-line=edit-width.tsx @@ -4,7 +4,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type ILine } from '#app/models/line.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { EditDesignLineWidthSchema } from '#app/schema/line' import { useIsPending } from '#app/utils/misc' import { DESIGN_LINE_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-new.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-new.tsx index 938b7427..b5b97901 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-new.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-new.tsx @@ -3,8 +3,8 @@ import { getFieldsetConstraint } from '@conform-to/zod' import { useActionData, useFetcher } from '@remix-run/react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { PanelIconButton } from '#app/components/ui/panel-icon-button' -import { type IArtboard } from '#app/models/artboard.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type NewDesignSchemaType, type designTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-palette-edit-value.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-palette-edit-value.tsx index c2cc50f6..ac1ffda6 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-palette-edit-value.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-palette-edit-value.tsx @@ -5,7 +5,7 @@ import { type ChangeEvent, type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { quickToast } from '#app/components/toaster' import { Input } from '#app/components/ui/input' -import { type IPalette } from '#app/models/palette.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' import { EditDesignPaletteValueSchema } from '#app/schema/palette' import { stringToHexcode, validateStringIsHexcode } from '#app/utils/colors' import { useIsPending } from '#app/utils/misc' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-reorder.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-reorder.tsx index 837e4892..11c9f885 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-reorder.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-reorder.tsx @@ -3,8 +3,8 @@ import { getFieldsetConstraint } from '@conform-to/zod' import { useActionData, useFetcher } from '@remix-run/react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { PanelIconButton } from '#app/components/ui/panel-icon-button' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type ReorderDesignSchemaType } from '#app/schema/design' import { useIsPending } from '#app/utils/misc' import { type IntentDesignReorder } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-basis.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-basis.tsx index 08c32687..27b047d2 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-basis.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-basis.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type IRotate } from '#app/models/rotate.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { EditDesignRotateBasisSchema, RotateBasisTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-value.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-value.tsx index 4a1fb429..8960d4da 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-value.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-rotate-edit-value.tsx @@ -4,7 +4,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type IRotate } from '#app/models/rotate.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { EditDesignRotateValueSchema } from '#app/schema/rotate' import { useIsPending } from '#app/utils/misc' import { DESIGN_ROTATE_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-basis.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-basis.tsx index 73423a88..574f44eb 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-basis.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-basis.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { EditDesignSizeBasisSchema, SizeBasisTypeEnum } from '#app/schema/size' import { useIsPending } from '#app/utils/misc' import { DESIGN_SIZE_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-format.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-format.tsx index 7ffbfe98..acbea81a 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-format.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-format.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { EditDesignSizeFormatSchema, SizeFormatTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-value.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-value.tsx index 14ab4093..34566e91 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-value.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-size-edit-value.tsx @@ -4,7 +4,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { EditDesignSizeValueSchema } from '#app/schema/size' import { useIsPending } from '#app/utils/misc' import { DESIGN_SIZE_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-basis.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-basis.tsx index 67e87490..b4082b78 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-basis.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-basis.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type IStroke } from '#app/models/stroke.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { EditDesignStrokeBasisSchema, StrokeBasisTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-style.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-style.tsx index 5bfc6a9f..b7052681 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-style.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-style.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type IStroke } from '#app/models/stroke.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { EditDesignStrokeStyleSchema, StrokeStyleTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-value.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-value.tsx index fc802d9f..ea4ce205 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-value.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-stroke-edit-value.tsx @@ -5,7 +5,7 @@ import { type ChangeEvent, type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { quickToast } from '#app/components/toaster' import { Input } from '#app/components/ui/input' -import { type IStroke } from '#app/models/stroke.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { EditDesignStrokeValueSchema } from '#app/schema/stroke' import { stringToHexcode, validateStringIsHexcode } from '#app/utils/colors' import { useIsPending } from '#app/utils/misc' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-template-edit-style.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-template-edit-style.tsx index 9dfb7f66..f588532b 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-template-edit-style.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-template-edit-style.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '#app/components/ui/select' -import { type ITemplate } from '#app/models/template.server' +import { type ITemplate } from '#app/models/design-type/template/template.server' import { EditDesignTemplateStyleSchema } from '#app/schema/template' import { useIsPending } from '#app/utils/misc' import { DESIGN_TEMPLATE_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-toggle-visible.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-toggle-visible.tsx index 4f667318..32460da0 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-toggle-visible.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/design/panel-form-design-toggle-visible.tsx @@ -3,9 +3,9 @@ import { getFieldsetConstraint } from '@conform-to/zod' import { useActionData, useFetcher } from '@remix-run/react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { PanelIconButton } from '#app/components/ui/panel-icon-button' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type ToggleVisibleDesignSchemaType } from '#app/schema/design' import { useIsPending } from '#app/utils/misc' import { type IntentDesignToggleVisible } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-description.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-description.tsx index 50467b57..8d1cf8d3 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-description.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-description.tsx @@ -5,7 +5,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Textarea } from '#app/components/ui/textarea' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { EditLayerDescriptionSchema } from '#app/schema/layer' import { useIsPending } from '#app/utils/misc' import { LAYER_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-name.tsx b/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-name.tsx index cdd3e3a4..bfddaeb5 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-name.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/forms/layer/panel-form-layer-edit-name.tsx @@ -5,7 +5,7 @@ import { useActionData, useFetcher } from '@remix-run/react' import { type FocusEvent } from 'react' import { AuthenticityTokenInput } from 'remix-utils/csrf/react' import { Input } from '#app/components/ui/input' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { EditLayerNameSchema } from '#app/schema/layer' import { useIsPending } from '#app/utils/misc' import { LAYER_INTENT } from '../../../intent' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-background.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-background.tsx index 1b89a47d..31450244 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-background.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-background.tsx @@ -4,13 +4,13 @@ import { SidebarPanelRow, SidebarPanelRowContainer, } from '#app/components/templates' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { PanelFormArtboardEditBackgroundColor } from '../../forms/artboard/panel-form-artboard-edit-background-color' export const PanelArtboardBackground = ({ artboard, }: { - artboard: PickedArtboardType + artboard: IArtboard }) => { return ( diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-designs.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-designs.tsx index c6f9ae0f..dc92c919 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-designs.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-designs.tsx @@ -1,5 +1,5 @@ -import { type PickedArtboardType } from '#app/models/artboard.server' -import { type IDesignsByType } from '#app/models/design.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignsByType } from '#app/models/design/design.server' import { designsByTypeToPanelArray } from '#app/utils/design' import { PanelDesignType } from '../design/type/panel-design-type' import { PanelArtboardBackground } from './panel-artboard-background' @@ -9,7 +9,7 @@ export const PanelArtboardDesigns = ({ artboard, designs, }: { - artboard: PickedArtboardType + artboard: IArtboard designs: IDesignsByType }) => { const artboardId = artboard.id diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-frame.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-frame.tsx index 98c01d0f..f552da06 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-frame.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-frame.tsx @@ -4,15 +4,11 @@ import { SidebarPanelRow, SidebarPanelRowContainer, } from '#app/components/templates' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { PanelFormArtboardEditHeight } from '../../forms/artboard/panel-form-artboard-edit-height' import { PanelFormArtboardEditWidth } from '../../forms/artboard/panel-form-artboard-edit-width' -export const PanelArtboardFrame = ({ - artboard, -}: { - artboard: PickedArtboardType -}) => { +export const PanelArtboardFrame = ({ artboard }: { artboard: IArtboard }) => { return ( diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-layers.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-layers.tsx index e48922ad..12b948b6 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-layers.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/artboard/panel-artboard-layers.tsx @@ -9,8 +9,8 @@ import { SidebarPanelRowValuesContainer, } from '#app/components/templates' import { Icon } from '#app/components/ui/icon' -import { type PickedArtboardType } from '#app/models/artboard.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type ILayer } from '#app/models/layer/layer.server' import { PanelFormArtboardLayerNew } from '../../forms/artboard/layer/panel-form-artboard-layer-new' import { PanelFormArtboardLayerReorder } from '../../forms/artboard/layer/panel-form-artboard-layer-reorder' import { PanelFormArtboardLayerToggleVisible } from '../../forms/artboard/layer/panel-form-artboard-layer-toggle-visible' @@ -20,7 +20,7 @@ export const PanelArtboardLayers = ({ artboard, layers, }: { - artboard: PickedArtboardType + artboard: IArtboard layers: ILayer[] }) => { const [searchParams, setSearchParams] = useSearchParams() diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-actions-design.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-actions-design.tsx index 33654f6c..741f99bc 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-actions-design.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-actions-design.tsx @@ -1,7 +1,7 @@ import { SidebarPanelRowActionsContainer } from '#app/components/templates' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type ToggleVisibleDesignSchemaType, type DeleteDesignSchemaType, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-header-design.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-header-design.tsx index 9b2a8963..fea6c8dc 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-header-design.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-header-design.tsx @@ -2,8 +2,8 @@ import { SidebarPanelHeader, SidebarPanelRowActionsContainer, } from '#app/components/templates' -import { type IArtboard } from '#app/models/artboard.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type NewDesignSchemaType, type designTypeEnum, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-reorder-design.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-reorder-design.tsx index 4ce82596..b04648a9 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-reorder-design.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/sidebar-panel-reorder-design.tsx @@ -1,7 +1,7 @@ import { SidebarPanelRowReorderContainer } from '#app/components/templates' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type ReorderDesignSchemaType } from '#app/schema/design' import { type IntentDesignReorder } from '../../../intent' import { PanelFormDesignReorder } from '../../forms/design/panel-form-design-reorder' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-fill.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-fill.tsx index 92495b9f..04c4dca4 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-fill.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-fill.tsx @@ -2,7 +2,7 @@ import { SidebarPanelRowValuesContainer, SidebarPanelRowValuesDisabled, } from '#app/components/templates' -import { type IFill } from '#app/models/fill.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { PanelFormDesignFillEditValue } from '../../../forms/design/panel-form-design-fill-edit-value' import { PanelPopoverDesignFill } from '../../../popovers/design/panel-popover-design-fill' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-layout.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-layout.tsx index 2675a5bb..f872cba6 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-layout.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-layout.tsx @@ -2,7 +2,7 @@ import { SidebarPanelRowValuesContainer, SidebarPanelRowValuesDisabled, } from '#app/components/templates' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { PanelFormDesignLayoutEditCount } from '../../../forms/design/panel-form-design-layout-edit-count' import { PanelPopoverDesignLayout } from '../../../popovers/design/panel-popover-design-layout' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-line.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-line.tsx index 96d33c96..6eb7a686 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-line.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-line.tsx @@ -1,6 +1,6 @@ import { SidebarPanelRowValuesContainer } from '#app/components/templates' import { Icon } from '#app/components/ui/icon' -import { type ILine } from '#app/models/line.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { LineFormatTypeEnum, lineBasisIcon, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-palette.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-palette.tsx index c556bdf4..fb4e821c 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-palette.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-palette.tsx @@ -1,5 +1,5 @@ import { SidebarPanelRowValuesContainer } from '#app/components/templates' -import { type IPalette } from '#app/models/palette.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' import { PanelFormDesignPaletteEditValue } from '../../../forms/design/panel-form-design-palette-edit-value' import { PanelPopoverDesignPalette } from '../../../popovers/design/panel-popover-design-palette' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-rotate.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-rotate.tsx index a5b63fb5..a2d3ccf4 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-rotate.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-rotate.tsx @@ -2,7 +2,7 @@ import { SidebarPanelRowValuesContainer, SidebarPanelRowValuesDisabled, } from '#app/components/templates' -import { type IRotate } from '#app/models/rotate.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { RotateBasisTypeEnum } from '#app/schema/rotate' import { PanelFormDesignRotateEditValue } from '../../../forms/design/panel-form-design-rotate-edit-value' import { PanelPopoverDesignRotate } from '../../../popovers/design/panel-popover-design-rotate' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-size.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-size.tsx index 2377a4c1..d03d0de4 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-size.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-size.tsx @@ -1,6 +1,6 @@ import { SidebarPanelRowValuesContainer } from '#app/components/templates' import { Icon } from '#app/components/ui/icon' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { SizeFormatTypeEnum, sizeBasisIcon, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-stroke.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-stroke.tsx index cd5cd1b3..3e7cca62 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-stroke.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-stroke.tsx @@ -2,7 +2,7 @@ import { SidebarPanelRowValuesContainer, SidebarPanelRowValuesDisabled, } from '#app/components/templates' -import { type IStroke } from '#app/models/stroke.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { PanelFormDesignStrokeEditValue } from '../../../forms/design/panel-form-design-stroke-edit-value' import { PanelPopoverDesignStroke } from '../../../popovers/design/panel-popover-design-stroke' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-template.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-template.tsx index efb99519..457654b5 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-template.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values-template.tsx @@ -2,7 +2,7 @@ import { SidebarPanelRowValuesContainer, SidebarPanelRowValuesDisabled, } from '#app/components/templates' -import { type ITemplate } from '#app/models/template.server' +import { type ITemplate } from '#app/models/design-type/template/template.server' import { PanelPopoverDesignTemplate } from '../../../popovers/design/panel-popover-design-template' export const PanelDesignTypeRowValuesTemplate = ({ diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values.tsx index 2958cf29..ea2e79a8 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row-values.tsx @@ -8,7 +8,7 @@ import { type IDesignWithLine, type IDesignWithRotate, type IDesignWithTemplate, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { DesignTypeEnum, type designTypeEnum } from '#app/schema/design' import { PanelDesignTypeRowValuesFill } from './panel-design-type-row-values-fill' import { PanelDesignTypeRowValuesLayout } from './panel-design-type-row-values-layout' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row.tsx index 607d89ce..aed18adb 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type-row.tsx @@ -2,9 +2,9 @@ import { SidebarPanelRow, SidebarPanelRowContainer, } from '#app/components/templates' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesign, type IDesignIdOrNull } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { DeleteArtboardDesignSchema, ReorderArtboardDesignSchema, diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type.tsx index d50157de..fe3d5663 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/design/type/panel-design-type.tsx @@ -1,10 +1,10 @@ import { SidebarPanel } from '#app/components/templates' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IDesignWithType, type IDesignWithLayout, -} from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +} from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designTypeEnum } from '#app/schema/design' import { NewArtboardDesignSchema } from '#app/schema/design-artboard' import { NewLayerDesignSchema } from '#app/schema/design-layer' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/panel/layer/panel-layer-designs.tsx b/app/routes/sketch+/artboards+/$slug_+/components/panel/layer/panel-layer-designs.tsx index 156820ce..fd5d2c2e 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/panel/layer/panel-layer-designs.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/panel/layer/panel-layer-designs.tsx @@ -1,5 +1,5 @@ -import { type IDesignsByType } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IDesignsByType } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { designsByTypeToPanelArray } from '#app/utils/design' import { PanelDesignType } from '../design/type/panel-design-type' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-fill.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-fill.tsx index cb072385..9d27732f 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-fill.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-fill.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type IFill } from '#app/models/fill.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { DesignTypeEnum } from '#app/schema/design' import { FillBasisTypeEnum, FillStyleTypeEnum } from '#app/schema/fill' import { PanelFormDesignFillEditBasis } from '../../forms/design/panel-form-design-fill-edit-basis' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-layout.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-layout.tsx index 53693f89..8d02c67a 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-layout.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-layout.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type ILayout } from '#app/models/layout.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { DesignTypeEnum } from '#app/schema/design' import { PanelFormDesignLayoutEditColumns } from '../../forms/design/panel-form-design-layout-edit-columns' import { PanelFormDesignLayoutEditRows } from '../../forms/design/panel-form-design-layout-edit-rows' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-line.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-line.tsx index 18364465..61d9f066 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-line.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-line.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type ILine } from '#app/models/line.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { DesignTypeEnum } from '#app/schema/design' import { PanelFormDesignLineEditBasis } from '../../forms/design/panel-form-design-line-edit-basis' import { PanelFormDesignLineEditFormat } from '../../forms/design/panel-form-design-line-edit-format' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-palette.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-palette.tsx index c732c2e3..73768495 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-palette.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-palette.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type IPalette } from '#app/models/palette.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' import { DesignTypeEnum } from '#app/schema/design' import { PanelPopover } from '../panel-popover' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-rotate.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-rotate.tsx index 450543ee..6400da71 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-rotate.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-rotate.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type IRotate } from '#app/models/rotate.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { DesignTypeEnum } from '#app/schema/design' import { PanelFormDesignRotateEditBasis } from '../../forms/design/panel-form-design-rotate-edit-basis' import { PanelPopover } from '../panel-popover' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-size.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-size.tsx index 7826878a..df78f5c9 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-size.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-size.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { DesignTypeEnum } from '#app/schema/design' import { PanelFormDesignSizeEditBasis } from '../../forms/design/panel-form-design-size-edit-basis' import { PanelFormDesignSizeEditFormat } from '../../forms/design/panel-form-design-size-edit-format' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-stroke.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-stroke.tsx index 7a85cb90..471b7740 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-stroke.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-stroke.tsx @@ -1,7 +1,7 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Input } from '#app/components/ui/input' import { Label } from '#app/components/ui/label' -import { type IStroke } from '#app/models/stroke.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { DesignTypeEnum } from '#app/schema/design' import { StrokeBasisTypeEnum } from '#app/schema/stroke' import { PanelFormDesignStrokeEditBasis } from '../../forms/design/panel-form-design-stroke-edit-basis' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-template.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-template.tsx index 35285c7f..ba37e82d 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-template.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/design/panel-popover-design-template.tsx @@ -1,6 +1,6 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Label } from '#app/components/ui/label' -import { type ITemplate } from '#app/models/template.server' +import { type ITemplate } from '#app/models/design-type/template/template.server' import { DesignTypeEnum } from '#app/schema/design' import { PanelFormDesignTemplateEditStyle } from '../../forms/design/panel-form-design-template-edit-style' import { PanelPopover } from '../panel-popover' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/popovers/layer/panel-popover-layer.tsx b/app/routes/sketch+/artboards+/$slug_+/components/popovers/layer/panel-popover-layer.tsx index 4e4f4afe..5aec6ec2 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/popovers/layer/panel-popover-layer.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/popovers/layer/panel-popover-layer.tsx @@ -1,8 +1,8 @@ import { SidebarPanelPopoverFormContainer } from '#app/components/layout/popover' import { Label } from '#app/components/ui/label' import { Separator } from '#app/components/ui/separator' -import { type IArtboard } from '#app/models/artboard.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type ILayer } from '#app/models/layer/layer.server' import { PanelFormArtboardLayerDelete } from '../../forms/artboard/layer/panel-form-artboard-layer-delete' import { PanelFormLayerEditDescription } from '../../forms/layer/panel-form-layer-edit-description' import { PanelFormLayerEditName } from '../../forms/layer/panel-form-layer-edit-name' diff --git a/app/routes/sketch+/artboards+/$slug_+/components/sidebars.tsx b/app/routes/sketch+/artboards+/$slug_+/components/sidebars.tsx index 8d735ef7..4e648f64 100644 --- a/app/routes/sketch+/artboards+/$slug_+/components/sidebars.tsx +++ b/app/routes/sketch+/artboards+/$slug_+/components/sidebars.tsx @@ -1,8 +1,8 @@ import { Sidebar } from '#app/components/layout' import { SidebarTabs, SidebarTabsContent } from '#app/components/templates' -import { type PickedArtboardType } from '#app/models/artboard.server' -import { type IDesignsByType } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignsByType } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { PanelActions } from './panel/actions/panel-actions' import { PanelArtboardDesigns } from './panel/artboard/panel-artboard-designs' import { PanelArtboardLayers } from './panel/artboard/panel-artboard-layers' @@ -12,7 +12,7 @@ export const SidebarLeft = ({ artboard, layers, }: { - artboard: PickedArtboardType + artboard: IArtboard layers: ILayer[] }) => { return ( @@ -35,7 +35,7 @@ export const SidebarRight = ({ layer, layerDesigns, }: { - artboard: PickedArtboardType + artboard: IArtboard artboardDesigns: IDesignsByType layer: ILayer | null | undefined layerDesigns: IDesignsByType | null | undefined diff --git a/app/routes/sketch+/artboards+/$slug_+/queries.ts b/app/routes/sketch+/artboards+/$slug_+/queries.ts index 53a10250..44c694da 100644 --- a/app/routes/sketch+/artboards+/$slug_+/queries.ts +++ b/app/routes/sketch+/artboards+/$slug_+/queries.ts @@ -1,10 +1,10 @@ import { type IArtboardGenerator } from '#app/definitions/artboard-generator' -import { type PickedArtboardType } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { findManyDesignsWithType, type IDesignsByType, -} from '#app/models/design.server' -import { findManyLayers, type ILayer } from '#app/models/layer.server' +} from '#app/models/design/design.server' +import { findManyLayers, type ILayer } from '#app/models/layer/layer.server' import { artboardBuildCreateService } from '#app/services/artboard/build/create.service' import { prisma } from '#app/utils/db.server' import { filterAndOrderDesignsByType } from '#app/utils/design' @@ -26,26 +26,9 @@ export const getOwner = async (userId: string) => { export const getArtboard = async ( userId: string, slug: string, -): Promise => { +): Promise => { return await prisma.artboard.findFirst({ where: { slug: slug, ownerId: userId }, - select: { - id: true, - name: true, - description: true, - slug: true, - width: true, - height: true, - backgroundColor: true, - updatedAt: true, - project: { - select: { - id: true, - name: true, - slug: true, - }, - }, - }, }) } @@ -79,7 +62,7 @@ export const getLayers = async ({ export const getArtboardDesigns = async ({ artboard, }: { - artboard: PickedArtboardType + artboard: IArtboard }): Promise => { const designs = await findManyDesignsWithType({ where: { artboardId: artboard.id }, @@ -100,7 +83,7 @@ export const getLayerDesigns = async ({ } export const getArtboardGenerator = async ( - artboard: PickedArtboardType, + artboard: IArtboard, layers: ILayer[], ): Promise => { const artboardBuild = await artboardBuildCreateService({ artboard, layers }) diff --git a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/header.artboard.dialog.form.branch.create.tsx b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/header.artboard.dialog.form.branch.create.tsx index 166378ab..185fc5af 100644 --- a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/header.artboard.dialog.form.branch.create.tsx +++ b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/header.artboard.dialog.form.branch.create.tsx @@ -17,9 +17,9 @@ import { } from '#app/components/ui/dialog' import { type IconName } from '#app/components/ui/icon' import { StatusButton } from '#app/components/ui/status-button' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IArtboardBranch } from '#app/models/artboard-branch/artboard-branch.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' import { stringToSlug, useIsPending } from '#app/utils/misc' import { getActionType, type RoutePath } from '#app/utils/routes.utils' diff --git a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.artboard-version.layers.tsx b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.artboard-version.layers.tsx index 0c335dac..16bf5977 100644 --- a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.artboard-version.layers.tsx +++ b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.artboard-version.layers.tsx @@ -1,6 +1,6 @@ import { DashboardEntityPanel } from '#app/components/templates/panel/dashboard-entity-panel' import { type IArtboardVersionWithDesignsAndLayers } from '#app/models/artboard-version/artboard-version.server' -import { type ILayerWithDesigns } from '#app/models/layer.server' +import { type ILayerWithDesigns } from '#app/models/layer/layer.server' import { DashboardPanelCreateArtboardVersionLayerStrategy } from '#app/strategies/component/dashboard-panel/create-entity.strategy' import { DashboardPanelArtboardVersionLayerActionStrategy } from '#app/strategies/component/dashboard-panel/entity-action/entity-action' import { DashboardPanelUpdateLayerValuesStrategy } from '#app/strategies/component/dashboard-panel/update-entity/update-entity-values.layer' diff --git a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.layer.tsx b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.layer.tsx index ed03b762..a6f05446 100644 --- a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.layer.tsx +++ b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.layer.tsx @@ -1,4 +1,4 @@ -import { type ILayerWithDesigns } from '#app/models/layer.server' +import { type ILayerWithDesigns } from '#app/models/layer/layer.server' import { DashboardPanelCreateLayerDesignTypeStrategy } from '#app/strategies/component/dashboard-panel/create-entity.strategy' import { DashboardPanelLayerDesignActionStrategy } from '#app/strategies/component/dashboard-panel/entity-action/entity-action' import { DashboardPanelUpdateLayerDesignTypeOrderStrategy } from '#app/strategies/component/dashboard-panel/update-entity-order.strategy' diff --git a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.tsx b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.tsx index a91c33a1..99cd636c 100644 --- a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.tsx +++ b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.designs.tsx @@ -1,5 +1,5 @@ import { DashboardEntityPanel } from '#app/components/templates/panel/dashboard-entity-panel' -import { type IDesignWithType } from '#app/models/design.server' +import { type IDesignWithType } from '#app/models/design/design.server' import { type designTypeEnum, type DesignParentType } from '#app/schema/design' import { type IDashboardPanelCreateEntityStrategy } from '#app/strategies/component/dashboard-panel/create-entity.strategy' import { type IDashboardPanelEntityActionStrategy } from '#app/strategies/component/dashboard-panel/entity-action/entity-action' diff --git a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.layer.tsx b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.layer.tsx index 20da035e..aa86570b 100644 --- a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.layer.tsx +++ b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.panel.layer.tsx @@ -1,4 +1,4 @@ -import { type ILayerWithDesigns } from '#app/models/layer.server' +import { type ILayerWithDesigns } from '#app/models/layer/layer.server' import { PanelLayerDesigns } from './sidebars.panel.designs.layer' export const PanelLayer = ({ layer }: { layer: ILayerWithDesigns }) => { diff --git a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.tsx b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.tsx index b287dcab..e2788157 100644 --- a/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.tsx +++ b/app/routes/sketch+/projects+/$projectSlug_+/artboards+/$artboardSlug+/__components/sidebars.tsx @@ -1,7 +1,7 @@ import { Sidebar } from '#app/components/layout' import { SidebarTabs, SidebarTabsContent } from '#app/components/templates' import { type IArtboardVersionWithDesignsAndLayers } from '#app/models/artboard-version/artboard-version.server' -import { type ILayerWithDesigns } from '#app/models/layer.server' +import { type ILayerWithDesigns } from '#app/models/layer/layer.server' import { PanelArtboardVersion } from './sidebars.panel.artboard-version' import { PanelArtboardVersionLayers } from './sidebars.panel.artboard-version.layers' import { PanelLayer } from './sidebars.panel.layer' diff --git a/app/routes/users+/$username_+/artboards+/components.tsx b/app/routes/users+/$username_+/artboards+/components.tsx index 9573b6cf..7d1a12c4 100644 --- a/app/routes/users+/$username_+/artboards+/components.tsx +++ b/app/routes/users+/$username_+/artboards+/components.tsx @@ -15,7 +15,7 @@ import { sideNavLinkDefaultClassName, } from '#app/components/shared' import { Icon } from '#app/components/ui/icon' -import { type IArtboardWithProject } from '#app/models/artboard.server' +import { type IArtboardWithProject } from '#app/models/artboard/artboard.server' import { useBreadcrumbs } from '#app/utils/breadcrumbs' import { cn, getUserImgSrc } from '#app/utils/misc' import { useOptionalUser, useUser } from '#app/utils/user' diff --git a/app/schema/design.ts b/app/schema/design.ts index 751d902b..de809699 100644 --- a/app/schema/design.ts +++ b/app/schema/design.ts @@ -1,6 +1,6 @@ import { z } from 'zod' import { type IArtboardVersionWithDesignsAndLayers } from '#app/models/artboard-version/artboard-version.server' -import { type ILayerWithDesigns } from '#app/models/layer.server' +import { type ILayerWithDesigns } from '#app/models/layer/layer.server' import { type ObjectValues } from '#app/utils/typescript-helpers' import { type ToggleVisibleArtboardDesignSchema, diff --git a/app/schema/entity.ts b/app/schema/entity.ts index 440c869c..2b9de49e 100644 --- a/app/schema/entity.ts +++ b/app/schema/entity.ts @@ -1,17 +1,20 @@ +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IArtboardBranch } from '#app/models/artboard-branch/artboard-branch.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesignWithType, type IDesign } from '#app/models/design.server' -import { type IFill } from '#app/models/fill.server' -import { type ILayer } from '#app/models/layer.server' -import { type ILayout } from '#app/models/layout.server' -import { type ILine } from '#app/models/line.server' -import { type IPalette } from '#app/models/palette.server' +import { + type IDesignWithType, + type IDesign, +} from '#app/models/design/design.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' +import { type ILine } from '#app/models/design-type/line/line.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' +import { type ISize } from '#app/models/design-type/size/size.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' +import { type ITemplate } from '#app/models/design-type/template/template.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type IProject } from '#app/models/project/project.server' -import { type IRotate } from '#app/models/rotate.server' -import { type ISize } from '#app/models/size.server' -import { type IStroke } from '#app/models/stroke.server' -import { type ITemplate } from '#app/models/template.server' import { type ObjectValues } from '#app/utils/typescript-helpers' import { type ReorderDesignSchemaType, diff --git a/app/services/artboard/branch/create.service.ts b/app/services/artboard/branch/create.service.ts index 31883ca7..a79cb532 100644 --- a/app/services/artboard/branch/create.service.ts +++ b/app/services/artboard/branch/create.service.ts @@ -1,4 +1,5 @@ import { invariant } from '@epic-web/invariant' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { createArtboardBranch, type IArtboardBranchCreatedResponse, @@ -8,7 +9,6 @@ import { type IArtboardBranch } from '#app/models/artboard-branch/artboard-branc import { createArtboardVersion } from '#app/models/artboard-version/artboard-version.create.server' import { getArtboardVersion } from '#app/models/artboard-version/artboard-version.get.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' import { type IUser } from '#app/models/user/user.server' import { ArtboardBranchDataCreateSchema } from '#app/schema/artboard-branch' import { ArtboardVersionDataCreateSchema } from '#app/schema/artboard-version' diff --git a/app/services/artboard/build/create.service.ts b/app/services/artboard/build/create.service.ts index ae3c5bce..b477c1d2 100644 --- a/app/services/artboard/build/create.service.ts +++ b/app/services/artboard/build/create.service.ts @@ -3,10 +3,11 @@ import { type IArtboardGenerator, type ILayerGenerator, } from '#app/definitions/artboard-generator' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { - type PickedArtboardType, - type IArtboard, -} from '#app/models/artboard.server' + type IDesignWithType, + findManyDesignsWithType, +} from '#app/models/design/design.server' import { getArtboardVisiblePalettes, getArtboardVisibleRotates, @@ -14,13 +15,9 @@ import { import { getLayerVisiblePalettes, getLayerVisibleRotates, -} from '#app/models/design-layer.server' -import { - findManyDesignsWithType, - type IDesignWithType, -} from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' -import { type IRotate } from '#app/models/rotate.server' +} from '#app/models/design-layer/design-layer.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type rotateBasisTypeEnum } from '#app/schema/rotate' import { filterSelectedDesignTypes, @@ -34,7 +31,7 @@ export const artboardBuildCreateService = async ({ artboard, layers, }: { - artboard: PickedArtboardType + artboard: IArtboard layers: ILayer[] }): Promise => { try { @@ -89,7 +86,7 @@ export const artboardBuildCreateService = async ({ const verifyArtboardGeneratorDesigns = async ({ artboard, }: { - artboard: PickedArtboardType + artboard: IArtboard }): Promise<{ artboardGeneratorDesigns: IGeneratorDesigns | null message: string @@ -149,7 +146,7 @@ const buildGeneratorArtboardLayer = async ({ artboardGeneratorDesigns, }: { artboardId: string - artboard: PickedArtboardType + artboard: IArtboard artboardGeneratorDesigns: IGeneratorDesigns }): Promise => { // get all visible palettes to use for fill or stroke @@ -172,11 +169,7 @@ const buildGeneratorArtboardLayer = async ({ } } -const getArtboardContainer = ({ - artboard, -}: { - artboard: PickedArtboardType -}) => { +const getArtboardContainer = ({ artboard }: { artboard: IArtboard }) => { const { width, height } = artboard return { width, diff --git a/app/services/artboard/design/create.service.ts b/app/services/artboard/design/create.service.ts index 3f808ee6..bf4cd9c0 100644 --- a/app/services/artboard/design/create.service.ts +++ b/app/services/artboard/design/create.service.ts @@ -1,10 +1,10 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IDesignCreatedResponse } from '#app/models/design/design.create.server' import { type IDesignCreateOverrides, type IDesignTypeCreateOverrides, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { type designTypeEnum } from '#app/schema/design' import { ArtboardCreateDesignStrategy } from '#app/strategies/design/create.strategy' import { ArtboardUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' diff --git a/app/services/artboard/design/delete.service.ts b/app/services/artboard/design/delete.service.ts index 9c2e3c7f..119b9247 100644 --- a/app/services/artboard/design/delete.service.ts +++ b/app/services/artboard/design/delete.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' import { ArtboardUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designDeleteService } from '../../design/delete.service' diff --git a/app/services/artboard/design/move-down.service.ts b/app/services/artboard/design/move-down.service.ts index e3440dfe..816a0a14 100644 --- a/app/services/artboard/design/move-down.service.ts +++ b/app/services/artboard/design/move-down.service.ts @@ -1,7 +1,10 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { + type IDesign, + type IDesignIdOrNull, +} from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' import { ArtboardUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designMoveDownService } from '../../design/move-down.service' diff --git a/app/services/artboard/design/move-up.service.ts b/app/services/artboard/design/move-up.service.ts index 05339b73..973e9bc5 100644 --- a/app/services/artboard/design/move-up.service.ts +++ b/app/services/artboard/design/move-up.service.ts @@ -1,7 +1,10 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { + type IDesign, + type IDesignIdOrNull, +} from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' import { ArtboardUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designMoveUpService } from '../../design/move-up.service' diff --git a/app/services/artboard/design/toggle-visible.service.ts b/app/services/artboard/design/toggle-visible.service.ts index 1fb0fe90..88a8f8b1 100644 --- a/app/services/artboard/design/toggle-visible.service.ts +++ b/app/services/artboard/design/toggle-visible.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' +import { type IDesign, type IDesignIdOrNull } from '#app/models/design/design.server' import { ArtboardUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designToggleVisibleService } from '../../design/toggle-visible.service' diff --git a/app/services/artboard/layer/clone-designs.service.ts b/app/services/artboard/layer/clone-designs.service.ts index dee0cf11..bb0e937e 100644 --- a/app/services/artboard/layer/clone-designs.service.ts +++ b/app/services/artboard/layer/clone-designs.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' -import { type IDesignEntityId } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IDesignEntityId } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designCloneSourceTypeEnum } from '#app/schema/design' import { CloneDesignToLayerStrategy } from '#app/strategies/design/clone.strategy' import { cloneDesignsService } from '../../design/clone-many.service' diff --git a/app/services/artboard/layer/create.service.ts b/app/services/artboard/layer/create.service.ts index 3984fd80..19895a81 100644 --- a/app/services/artboard/layer/create.service.ts +++ b/app/services/artboard/layer/create.service.ts @@ -1,6 +1,6 @@ import { type User, type Artboard } from '@prisma/client' import { type ILayerCreatedResponse } from '#app/models/layer/layer.create.server' -import { type ILayerCreateOverrides } from '#app/models/layer.server' +import { type ILayerCreateOverrides } from '#app/models/layer/layer.server' import { ArtboardCreateLayerStrategy } from '#app/strategies/layer/create.strategy' import { layerCreateService } from '../../layer/create.service' diff --git a/app/services/artboard/layer/delete.service.ts b/app/services/artboard/layer/delete.service.ts index aa4bf709..c30b5aa2 100644 --- a/app/services/artboard/layer/delete.service.ts +++ b/app/services/artboard/layer/delete.service.ts @@ -4,7 +4,7 @@ import { connectPrevAndNextLayers, updateLayerToHead, updateLayerToTail, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { prisma } from '#app/utils/db.server' export const artboardLayerDeleteService = async ({ diff --git a/app/services/artboard/layer/move-down.service.ts b/app/services/artboard/layer/move-down.service.ts index 8dc0f517..0cf5d425 100644 --- a/app/services/artboard/layer/move-down.service.ts +++ b/app/services/artboard/layer/move-down.service.ts @@ -1,11 +1,11 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { findFirstLayer, updateLayerRemoveNodes, type ILayer, updateLayerNodes, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { prisma } from '#app/utils/db.server' export const artboardLayerMoveDownService = async ({ diff --git a/app/services/artboard/layer/move-up.service.ts b/app/services/artboard/layer/move-up.service.ts index 96e289f8..933dc60e 100644 --- a/app/services/artboard/layer/move-up.service.ts +++ b/app/services/artboard/layer/move-up.service.ts @@ -1,11 +1,11 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { findFirstLayer, updateLayerRemoveNodes, type ILayer, updateLayerNodes, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { prisma } from '#app/utils/db.server' export const artboardLayerMoveUpService = async ({ diff --git a/app/services/artboard/layer/toggle-visible.service.ts b/app/services/artboard/layer/toggle-visible.service.ts index 4ac7a86b..96decf5b 100644 --- a/app/services/artboard/layer/toggle-visible.service.ts +++ b/app/services/artboard/layer/toggle-visible.service.ts @@ -1,10 +1,10 @@ import { type User } from '@prisma/client' -import { type IArtboard } from '#app/models/artboard.server' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { findFirstLayer, updateLayerVisible, type ILayer, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { prisma } from '#app/utils/db.server' export const artboardLayerToggleVisibleService = async ({ diff --git a/app/services/artboard/version/clone-designs.service.ts b/app/services/artboard/version/clone-designs.service.ts index 2ea2b615..37f74d0a 100644 --- a/app/services/artboard/version/clone-designs.service.ts +++ b/app/services/artboard/version/clone-designs.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IDesignEntityId } from '#app/models/design.server' +import { type IDesignEntityId } from '#app/models/design/design.server' import { type designCloneSourceTypeEnum } from '#app/schema/design' import { CloneDesignsToArtboardVersionStrategy } from '#app/strategies/design/clone.strategy' import { cloneDesignsService } from '../../design/clone-many.service' diff --git a/app/services/artboard/version/clone-layers.service.ts b/app/services/artboard/version/clone-layers.service.ts index c6e90b57..3201f295 100644 --- a/app/services/artboard/version/clone-layers.service.ts +++ b/app/services/artboard/version/clone-layers.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type ILayerEntityId } from '#app/models/layer.server' +import { type ILayerEntityId } from '#app/models/layer/layer.server' import { type layerCloneSourceTypeEnum } from '#app/schema/layer' import { CloneLayersToArtboardVersionStrategy } from '#app/strategies/layer/clone.strategy' import { cloneLayersService } from '../../layer/clone-many.service' diff --git a/app/services/artboard/version/design/create.service.ts b/app/services/artboard/version/design/create.service.ts index e3433248..8dce6a25 100644 --- a/app/services/artboard/version/design/create.service.ts +++ b/app/services/artboard/version/design/create.service.ts @@ -4,7 +4,7 @@ import { type IDesignCreatedResponse } from '#app/models/design/design.create.se import { type IDesignCreateOverrides, type IDesignTypeCreateOverrides, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { type designTypeEnum } from '#app/schema/design' import { ArtboardVersionCreateDesignStrategy } from '#app/strategies/design/create.strategy' import { ArtboardVersionUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' diff --git a/app/services/artboard/version/design/delete.service.ts b/app/services/artboard/version/design/delete.service.ts index 42bec122..5789ed0f 100644 --- a/app/services/artboard/version/design/delete.service.ts +++ b/app/services/artboard/version/design/delete.service.ts @@ -1,7 +1,7 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' import { type IDesignDeletedResponse } from '#app/models/design/design.delete.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' +import { type IDesignIdOrNull, type IDesign } from '#app/models/design/design.server' import { ArtboardVersionUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designDeleteService } from '../../../design/delete.service' diff --git a/app/services/artboard/version/design/move-down.service.ts b/app/services/artboard/version/design/move-down.service.ts index 6d519d69..c26a5d17 100644 --- a/app/services/artboard/version/design/move-down.service.ts +++ b/app/services/artboard/version/design/move-down.service.ts @@ -1,7 +1,10 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' +import { + type IDesign, + type IDesignIdOrNull, +} from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' import { ArtboardVersionUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designMoveDownService } from '../../../design/move-down.service' diff --git a/app/services/artboard/version/design/move-up.service.ts b/app/services/artboard/version/design/move-up.service.ts index 78403c38..02f4f266 100644 --- a/app/services/artboard/version/design/move-up.service.ts +++ b/app/services/artboard/version/design/move-up.service.ts @@ -1,7 +1,7 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' +import { type IDesign, type IDesignIdOrNull } from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' import { ArtboardVersionUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designMoveUpService } from '../../../design/move-up.service' diff --git a/app/services/artboard/version/design/toggle-visible.service.ts b/app/services/artboard/version/design/toggle-visible.service.ts index ce6acd73..de859db5 100644 --- a/app/services/artboard/version/design/toggle-visible.service.ts +++ b/app/services/artboard/version/design/toggle-visible.service.ts @@ -1,7 +1,10 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' +import { + type IDesign, + type IDesignIdOrNull, +} from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' import { ArtboardVersionUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designToggleVisibleService } from '../../../design/toggle-visible.service' diff --git a/app/services/artboard/version/generator/build.service.ts b/app/services/artboard/version/generator/build.service.ts index 3db6a92c..1a84aa49 100644 --- a/app/services/artboard/version/generator/build.service.ts +++ b/app/services/artboard/version/generator/build.service.ts @@ -4,20 +4,20 @@ import { type IArtboardVersionGenerator, } from '#app/definitions/artboard-generator' import { type IArtboardVersionWithDesignsAndLayers } from '#app/models/artboard-version/artboard-version.server' +import { + findManyDesignsWithType, + type IDesignWithType, +} from '#app/models/design/design.server' import { getArtboardVersionVisiblePalettes, getArtboardVersionVisibleRotates, -} from '#app/models/design-artboard-version.server' +} from '#app/models/design-artboard-version/design-artboard-version.server' import { getLayerVisiblePalettes, getLayerVisibleRotates, -} from '#app/models/design-layer.server' -import { - findManyDesignsWithType, - type IDesignWithType, -} from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' -import { type IRotate } from '#app/models/rotate.server' +} from '#app/models/design-layer/design-layer.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type rotateBasisTypeEnum } from '#app/schema/rotate' import { filterSelectedDesignTypes, diff --git a/app/services/artboard/version/layer/clone-designs.service.ts b/app/services/artboard/version/layer/clone-designs.service.ts index 1dfc329c..d99b75bd 100644 --- a/app/services/artboard/version/layer/clone-designs.service.ts +++ b/app/services/artboard/version/layer/clone-designs.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' -import { type IDesignEntityId } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IDesignEntityId } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designCloneSourceTypeEnum } from '#app/schema/design' import { CloneDesignToLayerStrategy } from '#app/strategies/design/clone.strategy' import { cloneDesignsService } from '../../../design/clone-many.service' diff --git a/app/services/artboard/version/layer/create.service.ts b/app/services/artboard/version/layer/create.service.ts index b2c0d274..5ac00740 100644 --- a/app/services/artboard/version/layer/create.service.ts +++ b/app/services/artboard/version/layer/create.service.ts @@ -1,7 +1,7 @@ import { type User } from '@prisma/client' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' import { type ILayerCreatedResponse } from '#app/models/layer/layer.create.server' -import { type ILayerCreateOverrides } from '#app/models/layer.server' +import { type ILayerCreateOverrides } from '#app/models/layer/layer.server' import { ArtboardVersionCreateLayerStrategy } from '#app/strategies/layer/create.strategy' import { layerCreateService } from '../../../layer/create.service' diff --git a/app/services/artboard/version/layer/delete.service.ts b/app/services/artboard/version/layer/delete.service.ts index 60b39ee5..c56d2f04 100644 --- a/app/services/artboard/version/layer/delete.service.ts +++ b/app/services/artboard/version/layer/delete.service.ts @@ -6,7 +6,7 @@ import { updateLayerToHead, updateLayerToTail, type ILayer, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { type IUser } from '#app/models/user/user.server' import { prisma } from '#app/utils/db.server' diff --git a/app/services/artboard/version/layer/move-down.service.ts b/app/services/artboard/version/layer/move-down.service.ts index 400fac88..24773eae 100644 --- a/app/services/artboard/version/layer/move-down.service.ts +++ b/app/services/artboard/version/layer/move-down.service.ts @@ -4,7 +4,7 @@ import { updateLayerRemoveNodes, type ILayer, updateLayerNodes, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { type IUser } from '#app/models/user/user.server' import { prisma } from '#app/utils/db.server' diff --git a/app/services/artboard/version/layer/move-up.service.ts b/app/services/artboard/version/layer/move-up.service.ts index 9d074d50..9f249e51 100644 --- a/app/services/artboard/version/layer/move-up.service.ts +++ b/app/services/artboard/version/layer/move-up.service.ts @@ -4,7 +4,7 @@ import { updateLayerRemoveNodes, type ILayer, updateLayerNodes, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { type IUser } from '#app/models/user/user.server' import { prisma } from '#app/utils/db.server' diff --git a/app/services/artboard/version/layer/select.service.ts b/app/services/artboard/version/layer/select.service.ts index 49ef4633..308b390c 100644 --- a/app/services/artboard/version/layer/select.service.ts +++ b/app/services/artboard/version/layer/select.service.ts @@ -1,9 +1,9 @@ import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' +import { findFirstLayer, type ILayer } from '#app/models/layer/layer.server' import { deselectArtboardVersionLayers, updateLayerSelected, } from '#app/models/layer-artboard-version/layer-artboard-version.update.server' -import { findFirstLayer, type ILayer } from '#app/models/layer.server' import { type IUser } from '#app/models/user/user.server' import { prisma } from '#app/utils/db.server' diff --git a/app/services/artboard/version/layer/toggle-visible.service.ts b/app/services/artboard/version/layer/toggle-visible.service.ts index 89040f7c..65bdf440 100644 --- a/app/services/artboard/version/layer/toggle-visible.service.ts +++ b/app/services/artboard/version/layer/toggle-visible.service.ts @@ -3,7 +3,7 @@ import { findFirstLayer, updateLayerVisible, type ILayer, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { type IUser } from '#app/models/user/user.server' import { prisma } from '#app/utils/db.server' diff --git a/app/services/design-type/update-fill.service.ts b/app/services/design-type/update-fill.service.ts index 70ae00af..ba5a5d13 100644 --- a/app/services/design-type/update-fill.service.ts +++ b/app/services/design-type/update-fill.service.ts @@ -1,12 +1,12 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { type IDesignTypeFillUpdatedResponse, updateDesignTypeFillBasis, updateDesignTypeFillValue, updateDesignTypeFillStyle, -} from '#app/models/design-type/design-type.update.fill.server' -import { type IDesign } from '#app/models/design.server' -import { type IFill } from '#app/models/fill.server' +} from '#app/models/design-type/fill/fill.update.server' export const updateDesignTypeFillValueService = async ({ userId, diff --git a/app/services/design-type/update-layout.service.ts b/app/services/design-type/update-layout.service.ts index 2a00b230..ee3d1450 100644 --- a/app/services/design-type/update-layout.service.ts +++ b/app/services/design-type/update-layout.service.ts @@ -1,13 +1,13 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type ILayout } from '#app/models/design-type/layout/layout.server' import { type IDesignTypeLayoutUpdatedResponse, updateDesignTypeLayoutCount, updateDesignTypeLayoutRows, updateDesignTypeLayoutColumns, updateDesignTypeLayoutStyle, -} from '#app/models/design-type/design-type.update.layout.server' -import { type IDesign } from '#app/models/design.server' -import { type ILayout } from '#app/models/layout.server' +} from '#app/models/design-type/layout/layout.update.server' export const updateDesignTypeLayoutCountService = async ({ userId, diff --git a/app/services/design-type/update-line.service.ts b/app/services/design-type/update-line.service.ts index a4b3800d..e4831566 100644 --- a/app/services/design-type/update-line.service.ts +++ b/app/services/design-type/update-line.service.ts @@ -1,12 +1,12 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type ILine } from '#app/models/design-type/line/line.server' import { type IDesignTypeLineUpdatedResponse, updateDesignTypeLineWidth, updateDesignTypeLineBasis, updateDesignTypeLineFormat, -} from '#app/models/design-type/design-type.update.line.server' -import { type IDesign } from '#app/models/design.server' -import { type ILine } from '#app/models/line.server' +} from '#app/models/design-type/line/line.update.server' export const updateDesignTypeLineWidthService = async ({ userId, diff --git a/app/services/design-type/update-palette.service.ts b/app/services/design-type/update-palette.service.ts index ba891dea..a8e90c37 100644 --- a/app/services/design-type/update-palette.service.ts +++ b/app/services/design-type/update-palette.service.ts @@ -1,10 +1,10 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type IPalette } from '#app/models/design-type/palette/palette.server' import { type IDesignTypePaletteUpdatedResponse, updateDesignTypePaletteValue, -} from '#app/models/design-type/design-type.update.palette.server' -import { type IDesign } from '#app/models/design.server' -import { type IPalette } from '#app/models/palette.server' +} from '#app/models/design-type/palette/palette.update.server' export const updateDesignTypePaletteValueService = async ({ userId, diff --git a/app/services/design-type/update-rotate.service.ts b/app/services/design-type/update-rotate.service.ts index f6443de9..ff030a98 100644 --- a/app/services/design-type/update-rotate.service.ts +++ b/app/services/design-type/update-rotate.service.ts @@ -1,11 +1,11 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { type IDesignTypeRotateUpdatedResponse, updateDesignTypeRotateValue, updateDesignTypeRotateBasis, -} from '#app/models/design-type/design-type.update.rotate.server' -import { type IDesign } from '#app/models/design.server' -import { type IRotate } from '#app/models/rotate.server' +} from '#app/models/design-type/rotate/rotate.update.server' export const updateDesignTypeRotateValueService = async ({ userId, diff --git a/app/services/design-type/update-size.service.ts b/app/services/design-type/update-size.service.ts index 7653aef9..b5fd8e0c 100644 --- a/app/services/design-type/update-size.service.ts +++ b/app/services/design-type/update-size.service.ts @@ -1,12 +1,12 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { type IDesignTypeSizeUpdatedResponse, updateDesignTypeSizeValue, updateDesignTypeSizeBasis, updateDesignTypeSizeFormat, -} from '#app/models/design-type/design-type.update.size.server' -import { type IDesign } from '#app/models/design.server' -import { type ISize } from '#app/models/size.server' +} from '#app/models/design-type/size/size.update.server' export const updateDesignTypeSizeValueService = async ({ userId, diff --git a/app/services/design-type/update-stroke.service.ts b/app/services/design-type/update-stroke.service.ts index 4334667c..f807d9a3 100644 --- a/app/services/design-type/update-stroke.service.ts +++ b/app/services/design-type/update-stroke.service.ts @@ -1,12 +1,12 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type IStroke } from '#app/models/design-type/stroke/stroke.server' import { type IDesignTypeStrokeUpdatedResponse, updateDesignTypeStrokeBasis, updateDesignTypeStrokeStyle, updateDesignTypeStrokeValue, -} from '#app/models/design-type/design-type.update.stroke.server' -import { type IDesign } from '#app/models/design.server' -import { type IStroke } from '#app/models/stroke.server' +} from '#app/models/design-type/stroke/stroke.update.server' export const updateDesignTypeStrokeValueService = async ({ userId, diff --git a/app/services/design-type/update-template.service.ts b/app/services/design-type/update-template.service.ts index 70ae00af..ba5a5d13 100644 --- a/app/services/design-type/update-template.service.ts +++ b/app/services/design-type/update-template.service.ts @@ -1,12 +1,12 @@ import { type User } from '@sentry/remix' +import { type IDesign } from '#app/models/design/design.server' +import { type IFill } from '#app/models/design-type/fill/fill.server' import { type IDesignTypeFillUpdatedResponse, updateDesignTypeFillBasis, updateDesignTypeFillValue, updateDesignTypeFillStyle, -} from '#app/models/design-type/design-type.update.fill.server' -import { type IDesign } from '#app/models/design.server' -import { type IFill } from '#app/models/fill.server' +} from '#app/models/design-type/fill/fill.update.server' export const updateDesignTypeFillValueService = async ({ userId, diff --git a/app/services/design/clone-many.service.ts b/app/services/design/clone-many.service.ts index b0d2a7e8..853b82a1 100644 --- a/app/services/design/clone-many.service.ts +++ b/app/services/design/clone-many.service.ts @@ -4,7 +4,7 @@ import { type IDesignWithType, type IDesignsByType, findManyDesignsWithType, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { DesignCloneSourceTypeEnum, type designCloneSourceTypeEnum, diff --git a/app/services/design/create.service.ts b/app/services/design/create.service.ts index 11b38972..c87796db 100644 --- a/app/services/design/create.service.ts +++ b/app/services/design/create.service.ts @@ -1,20 +1,20 @@ import { type User } from '@prisma/client' import { type IDesignCreatedResponse } from '#app/models/design/design.create.server' import { - type IDesignCreateOverrides, connectPrevAndNextDesigns, type IDesignTypeCreateOverrides, type IDesign, type IDesignEntityId, -} from '#app/models/design.server' -import { createDesignFill } from '#app/models/fill.server' -import { createDesignLayout } from '#app/models/layout.server' -import { createDesignLine } from '#app/models/line.server' -import { createDesignPalette } from '#app/models/palette.server' -import { createDesignRotate } from '#app/models/rotate.server' -import { createDesignSize } from '#app/models/size.server' -import { createDesignStroke } from '#app/models/stroke.server' -import { createDesignTemplate } from '#app/models/template.server' + type IDesignCreateOverrides, +} from '#app/models/design/design.server' +import { createDesignFill } from '#app/models/design-type/fill/fill.create.server' +import { createDesignLayout } from '#app/models/design-type/layout/layout.create.server' +import { createDesignLine } from '#app/models/design-type/line/line.create.server' +import { createDesignPalette } from '#app/models/design-type/palette/palette.create.server' +import { createDesignRotate } from '#app/models/design-type/rotate/rotate.create.server' +import { createDesignSize } from '#app/models/design-type/size/size.create.server' +import { createDesignStroke } from '#app/models/design-type/stroke/stroke.create.server' +import { createDesignTemplate } from '#app/models/design-type/template/template.create.server' import { type designTypeEnum } from '#app/schema/design' import { type ICreateDesignStrategy } from '#app/strategies/design/create.strategy' import { type IUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' diff --git a/app/services/design/delete.service.ts b/app/services/design/delete.service.ts index 7c720cfc..a5662cc8 100644 --- a/app/services/design/delete.service.ts +++ b/app/services/design/delete.service.ts @@ -11,7 +11,7 @@ import { connectPrevAndNextDesigns, type IDesignEntityId, type IDesignIdOrNull, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { type designTypeEnum } from '#app/schema/design' import { type IUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { prisma } from '#app/utils/db.server' diff --git a/app/services/design/design-type/clone-many.service.ts b/app/services/design/design-type/clone-many.service.ts index b5107650..7996c3c4 100644 --- a/app/services/design/design-type/clone-many.service.ts +++ b/app/services/design/design-type/clone-many.service.ts @@ -3,7 +3,7 @@ import { type IDesignEntityId, type IDesignCreateOverrides, type IDesignWithType, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { type ICloneDesignsStrategy } from '#app/strategies/design/clone.strategy' import { type ICloneDesignTypeStrategy } from '#app/strategies/design-type/clone.strategy' diff --git a/app/services/design/move-down.service.ts b/app/services/design/move-down.service.ts index b8d49083..ecc94367 100644 --- a/app/services/design/move-down.service.ts +++ b/app/services/design/move-down.service.ts @@ -1,5 +1,4 @@ import { type User } from '@prisma/client' -import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' import { type IDesign, findFirstDesign, @@ -7,7 +6,8 @@ import { updateDesignNodes, type IDesignIdOrNull, type IDesignEntityId, -} from '#app/models/design.server' +} from '#app/models/design/design.server' +import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' import { type designTypeEnum } from '#app/schema/design' import { type IUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { prisma } from '#app/utils/db.server' diff --git a/app/services/design/move-up.service.ts b/app/services/design/move-up.service.ts index a1487a70..b43fb547 100644 --- a/app/services/design/move-up.service.ts +++ b/app/services/design/move-up.service.ts @@ -1,5 +1,4 @@ import { type User } from '@prisma/client' -import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' import { type IDesign, findFirstDesign, @@ -7,7 +6,8 @@ import { updateDesignNodes, type IDesignIdOrNull, type IDesignEntityId, -} from '#app/models/design.server' +} from '#app/models/design/design.server' +import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' import { type designTypeEnum } from '#app/schema/design' import { type IUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { prisma } from '#app/utils/db.server' diff --git a/app/services/design/toggle-visible.service.ts b/app/services/design/toggle-visible.service.ts index 76ac6e8f..04a03e0e 100644 --- a/app/services/design/toggle-visible.service.ts +++ b/app/services/design/toggle-visible.service.ts @@ -1,14 +1,14 @@ import { type User } from '@prisma/client' -import { - updateDesignVisible, - type IDesignUpdatedResponse, -} from '#app/models/design/design.update.server' import { findFirstDesign, type IDesign, type IDesignEntityId, type IDesignIdOrNull, -} from '#app/models/design.server' +} from '#app/models/design/design.server' +import { + updateDesignVisible, + type IDesignUpdatedResponse, +} from '#app/models/design/design.update.server' import { type designTypeEnum } from '#app/schema/design' import { type IUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { prisma } from '#app/utils/db.server' diff --git a/app/services/design/update-selected.service.ts b/app/services/design/update-selected.service.ts index 90c322f5..91189778 100644 --- a/app/services/design/update-selected.service.ts +++ b/app/services/design/update-selected.service.ts @@ -1,7 +1,7 @@ import { type IDesignEntityId, type IDesignIdOrNull, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { type designTypeEnum } from '#app/schema/design' import { type IUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' diff --git a/app/services/layer/clone-designs.service.ts b/app/services/layer/clone-designs.service.ts index 47accb15..e2674dc3 100644 --- a/app/services/layer/clone-designs.service.ts +++ b/app/services/layer/clone-designs.service.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' -import { type IDesignEntityId } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type IDesignEntityId } from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designCloneSourceTypeEnum } from '#app/schema/design' import { CloneDesignToLayerStrategy } from '#app/strategies/design/clone.strategy' import { cloneDesignsService } from '../design/clone-many.service' diff --git a/app/services/layer/clone-many.service.ts b/app/services/layer/clone-many.service.ts index 86fc496e..14cf241c 100644 --- a/app/services/layer/clone-many.service.ts +++ b/app/services/layer/clone-many.service.ts @@ -3,7 +3,7 @@ import { getLayersWithDesigns } from '#app/models/layer/layer.get.server' import { type ILayerWithDesigns, type ILayerEntityId, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { LayerCloneSourceTypeEnum, type layerCloneSourceTypeEnum, diff --git a/app/services/layer/clone-one.service.ts b/app/services/layer/clone-one.service.ts index 29bd04a2..937f87e1 100644 --- a/app/services/layer/clone-one.service.ts +++ b/app/services/layer/clone-one.service.ts @@ -3,7 +3,7 @@ import { type ILayerWithDesigns, type ILayerEntityId, type ILayerCreateOverrides, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { DesignCloneSourceTypeEnum } from '#app/schema/design' import { type ICloneLayersStrategy } from '#app/strategies/layer/clone.strategy' import { layerLayerCloneDesignsService } from './clone-designs.service' diff --git a/app/services/layer/create.service.ts b/app/services/layer/create.service.ts index 2869e7b4..2fb50101 100644 --- a/app/services/layer/create.service.ts +++ b/app/services/layer/create.service.ts @@ -3,7 +3,7 @@ import { type ILayerCreateOverrides, connectPrevAndNextLayers, type ILayerEntityId, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { type ICreateLayerStrategy } from '#app/strategies/layer/create.strategy' import { prisma } from '#app/utils/db.server' diff --git a/app/services/layer/design/create.service.ts b/app/services/layer/design/create.service.ts index 1c9d3e66..d1f173e7 100644 --- a/app/services/layer/design/create.service.ts +++ b/app/services/layer/design/create.service.ts @@ -3,8 +3,8 @@ import { type IDesignCreatedResponse } from '#app/models/design/design.create.se import { type IDesignCreateOverrides, type IDesignTypeCreateOverrides, -} from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +} from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designTypeEnum } from '#app/schema/design' import { LayerCreateDesignStrategy } from '#app/strategies/design/create.strategy' import { LayerUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' diff --git a/app/services/layer/design/delete.service.ts b/app/services/layer/design/delete.service.ts index 23e2d4b6..c23be6b2 100644 --- a/app/services/layer/design/delete.service.ts +++ b/app/services/layer/design/delete.service.ts @@ -1,6 +1,9 @@ import { type User } from '@prisma/client' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { + type IDesignIdOrNull, + type IDesign, +} from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { LayerUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designDeleteService } from '../../design/delete.service' diff --git a/app/services/layer/design/move-down.service.ts b/app/services/layer/design/move-down.service.ts index 9109acf5..a7644fbe 100644 --- a/app/services/layer/design/move-down.service.ts +++ b/app/services/layer/design/move-down.service.ts @@ -1,7 +1,10 @@ import { type User } from '@prisma/client' +import { + type IDesign, + type IDesignIdOrNull, +} from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { LayerUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designMoveDownService } from '../../design/move-down.service' diff --git a/app/services/layer/design/move-up.service.ts b/app/services/layer/design/move-up.service.ts index 71541271..95d2ab95 100644 --- a/app/services/layer/design/move-up.service.ts +++ b/app/services/layer/design/move-up.service.ts @@ -1,7 +1,10 @@ import { type User } from '@prisma/client' +import { + type IDesignIdOrNull, + type IDesign, +} from '#app/models/design/design.server' import { type IDesignUpdatedResponse } from '#app/models/design/design.update.server' -import { type IDesignIdOrNull, type IDesign } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { LayerUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designMoveUpService } from '../../design/move-up.service' diff --git a/app/services/layer/design/toggle-visible.service.ts b/app/services/layer/design/toggle-visible.service.ts index d0bebbfa..a4f14c97 100644 --- a/app/services/layer/design/toggle-visible.service.ts +++ b/app/services/layer/design/toggle-visible.service.ts @@ -1,6 +1,9 @@ import { type User } from '@prisma/client' -import { type IDesign, type IDesignIdOrNull } from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +import { + type IDesign, + type IDesignIdOrNull, +} from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { LayerUpdateSelectedDesignStrategy } from '#app/strategies/design/update-selected.strategy' import { designToggleVisibleService } from '../../design/toggle-visible.service' diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.fill.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.fill.ts index f0b85c1b..fef6d658 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.fill.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.fill.ts @@ -1,4 +1,4 @@ -import { type IDesignWithFill } from '#app/models/design.server' +import { type IDesignWithFill } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignFillBasisSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.layout.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.layout.ts index 5ed16422..ff1664cf 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.layout.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.layout.ts @@ -1,4 +1,4 @@ -import { type IDesignWithLayout } from '#app/models/design.server' +import { type IDesignWithLayout } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignLayoutColumnsSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.line.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.line.ts index 7be42c0b..3669717a 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.line.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.line.ts @@ -1,5 +1,5 @@ import { type IconName } from '#app/components/ui/icon' -import { type IDesignWithLine } from '#app/models/design.server' +import { type IDesignWithLine } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignLineBasisSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.palette.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.palette.ts index dc887b9d..9bfebc2e 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.palette.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.palette.ts @@ -1,4 +1,4 @@ -import { type IDesignWithPalette } from '#app/models/design.server' +import { type IDesignWithPalette } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignPaletteValueSchema } from '#app/schema/palette' import { Routes } from '#app/utils/routes.utils' diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.rotate.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.rotate.ts index 229e77a5..495bb470 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.rotate.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.rotate.ts @@ -1,4 +1,4 @@ -import { type IDesignWithRotate } from '#app/models/design.server' +import { type IDesignWithRotate } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignRotateBasisSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.size.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.size.ts index 987069eb..2cbb22c8 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.size.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.size.ts @@ -1,5 +1,5 @@ import { type IconName } from '#app/components/ui/icon' -import { type IDesignWithSize } from '#app/models/design.server' +import { type IDesignWithSize } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignSizeBasisSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.stroke.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.stroke.ts index 8b8d94ba..f92aed19 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.stroke.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.stroke.ts @@ -1,4 +1,4 @@ -import { type IDesignWithStroke } from '#app/models/design.server' +import { type IDesignWithStroke } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignStrokeBasisSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.template.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.template.ts index e2c48438..dc9c0b31 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.template.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.template.ts @@ -1,4 +1,4 @@ -import { type IDesignWithTemplate } from '#app/models/design.server' +import { type IDesignWithTemplate } from '#app/models/design/design.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditDesignTemplateStyleSchema, diff --git a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.layer.ts b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.layer.ts index 4098c6e2..39f4bbb4 100644 --- a/app/strategies/component/dashboard-panel/update-entity/update-entity-values.layer.ts +++ b/app/strategies/component/dashboard-panel/update-entity/update-entity-values.layer.ts @@ -1,5 +1,5 @@ import { type IconName } from '#app/components/ui/icon' -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { EntityFormType, EntityParentIdType } from '#app/schema/entity' import { EditLayerDescriptionSchema, diff --git a/app/strategies/design-type/clone.strategy.ts b/app/strategies/design-type/clone.strategy.ts index b7709fb9..4c103f4e 100644 --- a/app/strategies/design-type/clone.strategy.ts +++ b/app/strategies/design-type/clone.strategy.ts @@ -10,7 +10,7 @@ import { type IDesignWithLayout, type IDesignWithTemplate, type IDesignsByType, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { DesignTypeEnum, type designTypeEnum } from '#app/schema/design' export interface ICloneDesignTypeStrategy { diff --git a/app/strategies/design/clone.strategy.ts b/app/strategies/design/clone.strategy.ts index e637b398..b5bee51a 100644 --- a/app/strategies/design/clone.strategy.ts +++ b/app/strategies/design/clone.strategy.ts @@ -4,7 +4,7 @@ import { type IDesignTypeCreateOverrides, type IDesignCreateOverrides, type IDesignEntityId, -} from '#app/models/design.server' +} from '#app/models/design/design.server' import { type designTypeEnum } from '#app/schema/design' import { artboardVersionDesignCreateService } from '#app/services/artboard/version/design/create.service' import { layerDesignCreateService } from '#app/services/layer/design/create.service' diff --git a/app/strategies/design/create.strategy.ts b/app/strategies/design/create.strategy.ts index bfd73936..cf0a4515 100644 --- a/app/strategies/design/create.strategy.ts +++ b/app/strategies/design/create.strategy.ts @@ -1,6 +1,6 @@ import { type User } from '@prisma/client' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' import { createArtboardVersionDesign, createDesign, @@ -10,8 +10,8 @@ import { type IDesign, type IDesignCreateOverrides, type IDesignEntityId, -} from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +} from '#app/models/design/design.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designTypeEnum } from '#app/schema/design' import { ArtboardDesignDataCreateSchema } from '#app/schema/design-artboard' import { LayerDesignDataCreateSchema } from '#app/schema/design-layer' diff --git a/app/strategies/design/update-selected.strategy.ts b/app/strategies/design/update-selected.strategy.ts index 5a57507a..adf1cf8d 100644 --- a/app/strategies/design/update-selected.strategy.ts +++ b/app/strategies/design/update-selected.strategy.ts @@ -1,10 +1,15 @@ +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' +import { + type IDesign, + type IDesignEntityId, + type IDesignIdOrNull, +} from '#app/models/design/design.server' import { findFirstVisibleArtboardVersionDesignByType } from '#app/models/design-artboard-version/design-artboard-version.get.server' import { deselectArtboardVersionSelectedDesign, updateArtboardVersionSelectedDesign, -} from '#app/models/design-artboard-version.server' +} from '#app/models/design-artboard-version/design-artboard-version.server' import { deselectArtboardSelectedDesign, findFirstVisibleArtboardDesignByType, @@ -14,13 +19,8 @@ import { findFirstVisibleLayerDesignByType } from '#app/models/design-layer/desi import { deselectLayerSelectedDesign, updateLayerSelectedDesign, -} from '#app/models/design-layer.server' -import { - type IDesign, - type IDesignEntityId, - type IDesignIdOrNull, -} from '#app/models/design.server' -import { type ILayer } from '#app/models/layer.server' +} from '#app/models/design-layer/design-layer.server' +import { type ILayer } from '#app/models/layer/layer.server' import { type designTypeEnum } from '#app/schema/design' import { prisma } from '#app/utils/db.server' diff --git a/app/strategies/layer/clone.strategy.ts b/app/strategies/layer/clone.strategy.ts index 61e7c980..e6e048b8 100644 --- a/app/strategies/layer/clone.strategy.ts +++ b/app/strategies/layer/clone.strategy.ts @@ -3,7 +3,7 @@ import { type ILayerCreatedResponse } from '#app/models/layer/layer.create.serve import { type ILayerCreateOverrides, type ILayerEntityId, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { artboardVersionLayerCreateService } from '#app/services/artboard/version/layer/create.service' export interface ICloneLayersStrategy { diff --git a/app/strategies/layer/create.strategy.ts b/app/strategies/layer/create.strategy.ts index 339a95d7..ff7e32d8 100644 --- a/app/strategies/layer/create.strategy.ts +++ b/app/strategies/layer/create.strategy.ts @@ -1,13 +1,13 @@ import { type User } from '@prisma/client' +import { type IArtboard } from '#app/models/artboard/artboard.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboard } from '#app/models/artboard.server' import { createLayer } from '#app/models/layer/layer.create.server' import { findFirstLayer, type ILayer, type ILayerCreateOverrides, type ILayerEntityId, -} from '#app/models/layer.server' +} from '#app/models/layer/layer.server' import { DesignCloneSourceTypeEnum } from '#app/schema/design' import { ArtboardLayerDataCreateSchema } from '#app/schema/layer-artboard' import { ArtboardVersionLayerDataCreateSchema } from '#app/schema/layer-artboard-version' diff --git a/app/utils/design.ts b/app/utils/design.ts index c7af7c2d..96fa7e5b 100644 --- a/app/utils/design.ts +++ b/app/utils/design.ts @@ -12,15 +12,15 @@ import { type IDesignsByType, type ISelectedDesigns, type ISelectedDesignsFiltered, -} from '#app/models/design.server' -import { findFirstFillInDesignArray } from '#app/models/fill.server' -import { findFirstLayoutInDesignArray } from '#app/models/layout.server' -import { findFirstLineInDesignArray } from '#app/models/line.server' -import { findFirstPaletteInDesignArray } from '#app/models/palette.server' -import { findFirstRotateInDesignArray } from '#app/models/rotate.server' -import { findFirstSizeInDesignArray } from '#app/models/size.server' -import { findFirstStrokeInDesignArray } from '#app/models/stroke.server' -import { findFirstTemplateInDesignArray } from '#app/models/template.server' +} from '#app/models/design/design.server' +import { findFirstFillInDesignArray } from '#app/models/design-type/fill/fill.get.server' +import { findFirstLayoutInDesignArray } from '#app/models/design-type/layout/layout.get.server' +import { findFirstLineInDesignArray } from '#app/models/design-type/line/line.get.server' +import { findFirstPaletteInDesignArray } from '#app/models/design-type/palette/palette.get.server' +import { findFirstRotateInDesignArray } from '#app/models/design-type/rotate/rotate.get.server' +import { findFirstSizeInDesignArray } from '#app/models/design-type/size/size.get.server' +import { findFirstStrokeInDesignArray } from '#app/models/design-type/stroke/stroke.get.server' +import { findFirstTemplateInDesignArray } from '#app/models/design-type/template/template.get.server' import { DesignTypeEnum, type designTypeEnum } from '#app/schema/design' import { type IDashboardPanelUpdateEntityValuesStrategy } from '#app/strategies/component/dashboard-panel/update-entity/update-entity-values' import { DashboardPanelUpdateDesignTypeFillValuesStrategy } from '#app/strategies/component/dashboard-panel/update-entity/update-entity-values.design.type.fill' diff --git a/app/utils/layer.utils.ts b/app/utils/layer.utils.ts index 7aeb3ccb..b8e05ef1 100644 --- a/app/utils/layer.utils.ts +++ b/app/utils/layer.utils.ts @@ -1,4 +1,4 @@ -import { type ILayer } from '#app/models/layer.server' +import { type ILayer } from '#app/models/layer/layer.server' export const filterLayersVisible = ({ layers, diff --git a/app/utils/line.ts b/app/utils/line.ts index 3bf8385b..749a8c22 100644 --- a/app/utils/line.ts +++ b/app/utils/line.ts @@ -1,6 +1,6 @@ import { type ILayerGeneratorContainer } from '#app/definitions/artboard-generator' -import { type ILine } from '#app/models/line.server' -import { type ISize } from '#app/models/size.server' +import { type ILine } from '#app/models/design-type/line/line.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { LineBasisTypeEnum } from '#app/schema/line' import { degreesToRadians } from './rotate' import { sizePercentToPixel } from './size' diff --git a/app/utils/rotate.ts b/app/utils/rotate.ts index 87a6bf3d..c52756d6 100644 --- a/app/utils/rotate.ts +++ b/app/utils/rotate.ts @@ -1,4 +1,4 @@ -import { type IRotate } from '#app/models/rotate.server' +import { type IRotate } from '#app/models/design-type/rotate/rotate.server' import { RotateArrayBasisTypeEnum, RotateBasisTypeEnum, diff --git a/app/utils/size.ts b/app/utils/size.ts index 84c5c4e5..d9b8b55e 100644 --- a/app/utils/size.ts +++ b/app/utils/size.ts @@ -1,5 +1,5 @@ import { type ILayerGeneratorContainer } from '#app/definitions/artboard-generator' -import { type ISize } from '#app/models/size.server' +import { type ISize } from '#app/models/design-type/size/size.server' import { SizeBasisTypeEnum } from '#app/schema/size' export const sizePercentToPixel = ({ diff --git a/package.json b/package.json index 93e07e93..0831fccb 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "prisma:studio": "prisma studio", "format": "prettier --write .", "lint": "eslint .", + "lint:fix": "eslint --fix .", "setup": "npm run build && prisma generate && prisma migrate deploy && prisma db seed && playwright install", "start": "cross-env NODE_ENV=production node .", "start:mocks": "cross-env NODE_ENV=production MOCKS=true tsx .", diff --git a/prisma/data-migrations/create-artboard-versions-and-branches.ts b/prisma/data-migrations/create-artboard-versions-and-branches.ts index 58706bf4..2ec352ca 100644 --- a/prisma/data-migrations/create-artboard-versions-and-branches.ts +++ b/prisma/data-migrations/create-artboard-versions-and-branches.ts @@ -1,7 +1,7 @@ import { getArtboardsWithDesignsAndLayers } from '#app/models/artboard/artboard.get.server' +import { type IArtboardWithDesignsAndLayers } from '#app/models/artboard/artboard.server' import { createDefaultArtboardBranchWithVersion } from '#app/models/artboard-branch/artboard-branch.create.server' import { type IArtboardVersion } from '#app/models/artboard-version/artboard-version.server' -import { type IArtboardWithDesignsAndLayers } from '#app/models/artboard.server' import { DesignCloneSourceTypeEnum } from '#app/schema/design' import { LayerCloneSourceTypeEnum } from '#app/schema/layer' import { artboardVersionCloneDesignsService } from '#app/services/artboard/version/clone-designs.service'