-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,477 additions
and
42 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
db/migrations/20240118153118_subsubsection_add_planning_period/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "Subsubsection" ADD COLUMN "planningPeriod" DOUBLE PRECISION; |
2 changes: 2 additions & 0 deletions
2
db/migrations/20240118153201_subsubsection_add_construction_period/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "Subsubsection" ADD COLUMN "constructionPeriod" DOUBLE PRECISION; |
2 changes: 2 additions & 0 deletions
2
db/migrations/20240118153339_subsubsection_add_quarter_planned_completion/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "Subsubsection" ADD COLUMN "quarterPlannedCompletion" TEXT; |
12 changes: 12 additions & 0 deletions
12
...grations/20240123152216_subsection_and_subsubsection_make_lengthkm_required/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
Warnings: | ||
- Made the column `lengthKm` on table `Subsection` required. This step will fail if there are existing NULL values in that column. | ||
- Made the column `lengthKm` on table `Subsubsection` required. This step will fail if there are existing NULL values in that column. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Subsection" ALTER COLUMN "lengthKm" SET NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Subsubsection" ALTER COLUMN "lengthKm" SET NOT NULL; |
9 changes: 9 additions & 0 deletions
9
...ubsection_replace_quarter_planned_completion_with_estimated_completion_date/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `quarterPlannedCompletion` on the `Subsubsection` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Subsubsection" DROP COLUMN "quarterPlannedCompletion", | ||
ADD COLUMN "estimatedCompletionDate" TIMESTAMP(3); |
23 changes: 23 additions & 0 deletions
23
db/migrations/20240125095210_subsection_add_field_network_hierarchy/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- AlterTable | ||
ALTER TABLE "Subsection" ADD COLUMN "networkHierarchyId" INTEGER; | ||
|
||
-- CreateTable | ||
CREATE TABLE "NetworkHierarchy" ( | ||
"id" SERIAL NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"slug" TEXT NOT NULL, | ||
"title" TEXT NOT NULL, | ||
"projectId" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "NetworkHierarchy_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "NetworkHierarchy_projectId_slug_key" ON "NetworkHierarchy"("projectId", "slug"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Subsection" ADD CONSTRAINT "Subsection_networkHierarchyId_fkey" FOREIGN KEY ("networkHierarchyId") REFERENCES "NetworkHierarchy"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "NetworkHierarchy" ADD CONSTRAINT "NetworkHierarchy_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
5 changes: 5 additions & 0 deletions
5
db/migrations/20240125104441_subsection_add_field_priority/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- CreateEnum | ||
CREATE TYPE "PriorityEnum" AS ENUM ('OPEN', 'TOP', 'HIGH', 'MEDIUM', 'LOW'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Subsection" ADD COLUMN "priority" "PriorityEnum" NOT NULL DEFAULT 'OPEN'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Form, FormProps, LabeledTextField } from "src/core/components/forms" | ||
import { z } from "zod" | ||
export { FORM_ERROR } from "src/core/components/forms" | ||
|
||
export function NetworkHierarchyForm<S extends z.ZodType<any, any>>(props: FormProps<S>) { | ||
const { ...formProps } = props | ||
|
||
return ( | ||
<Form<S> {...formProps}> | ||
<LabeledTextField type="text" name="slug" label="Kurz-Titel und URL-Teil" /> | ||
<LabeledTextField type="text" name="title" label="Titel" /> | ||
</Form> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { resolver } from "@blitzjs/rpc" | ||
import db from "db" | ||
import { authorizeProjectAdmin } from "src/authorization" | ||
import { z } from "zod" | ||
import getProjectIdBySlug from "../../projects/queries/getProjectIdBySlug" | ||
import { OperatorSchema } from "src/operators/schema" | ||
|
||
const CreateOperatorSchema = OperatorSchema.omit({ projectId: true }).merge( | ||
z.object({ | ||
projectSlug: z.string(), | ||
}), | ||
) | ||
|
||
export default resolver.pipe( | ||
resolver.zod(CreateOperatorSchema), | ||
authorizeProjectAdmin(getProjectIdBySlug), | ||
async ({ projectSlug, ...input }) => | ||
await db.networkHierarchy.create({ | ||
data: { | ||
...input, | ||
projectId: await getProjectIdBySlug(projectSlug), | ||
}, | ||
}), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { resolver } from "@blitzjs/rpc" | ||
import db from "db" | ||
import { authorizeProjectAdmin } from "src/authorization" | ||
import { z } from "zod" | ||
import getNetworkHierarchyProjectId from "../queries/getNetworkHierarchyProjectId" | ||
|
||
const DeleteNetworkHierarchySchema = z.object({ | ||
id: z.number(), | ||
}) | ||
|
||
export default resolver.pipe( | ||
resolver.zod(DeleteNetworkHierarchySchema), | ||
authorizeProjectAdmin(getNetworkHierarchyProjectId), | ||
async ({ id }) => await db.networkHierarchy.deleteMany({ where: { id } }), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { resolver } from "@blitzjs/rpc" | ||
import db from "db" | ||
import { authorizeProjectAdmin } from "src/authorization" | ||
import { z } from "zod" | ||
import getQualityLevelProjectId from "../queries/getNetworkHierarchyProjectId" | ||
import { NetworkHierarchySchema } from "../schema" | ||
|
||
const UpdateNetworkHierarchySchema = NetworkHierarchySchema.merge( | ||
z.object({ | ||
id: z.number(), | ||
}), | ||
) | ||
|
||
export default resolver.pipe( | ||
resolver.zod(UpdateNetworkHierarchySchema), | ||
authorizeProjectAdmin(getQualityLevelProjectId), | ||
async ({ id, ...data }) => | ||
await db.networkHierarchy.update({ | ||
where: { id }, | ||
data, | ||
}), | ||
) |
Oops, something went wrong.