Skip to content

Commit

Permalink
feat(INTERNAL-1360): add order to State
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorGoryany committed Nov 20, 2024
1 parent 09b969b commit 421c26a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions generated/kysely/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export type State = {
title: string;
type: StateType;
default: boolean | null;
order: Generated<number>;
hue: Generated<number>;
lightForeground: string | null;
lightBackground: string | null;
Expand Down
2 changes: 2 additions & 0 deletions prisma/migrations/20241117152208_state_order/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "State" ADD COLUMN "order" SERIAL NOT NULL;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ model State {
type StateType
flows Flow[]
default Boolean?
order Int @default(autoincrement())
hue Int @default(1)
goals Goal[] @relation("goalState")
comments Comment[]
Expand Down
2 changes: 1 addition & 1 deletion trpc/router/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { db } from '../connection/kysely';
import { protectedProcedure, router } from '../trpcBackend';

export const state = router({
all: protectedProcedure.query(async () => db.selectFrom('State').selectAll().execute()),
all: protectedProcedure.query(async () => db.selectFrom('State').selectAll().orderBy('State.order asc').execute()),
});

0 comments on commit 421c26a

Please sign in to comment.