From 8b1601b7d1a41365a365d03097332056ac5d81f5 Mon Sep 17 00:00:00 2001 From: Michael Haufe Date: Sat, 20 Jul 2024 23:01:07 +0000 Subject: [PATCH] Partial implementation --- .github/workflows/build-release.yml | 2 + .github/workflows/build.yml | 2 + .gitignore | 5 +- migrations/.snapshot-cathedral.json | 1691 +++++++++++++++++ migrations/Migration20240719152506.ts | 10 - migrations/Migration20240720212912.ts | 144 ++ mikro-orm.config.ts | 34 +- nuxt.config.ts | 16 +- package.json | 10 +- pages/solution/[slug]/edit-entry.client.vue | 2 +- .../[slug]/environment/constraints.client.vue | 2 +- .../[slug]/goals/functionality.client.vue | 9 +- .../[slug]/goals/rationale.client.vue | 42 +- .../[slug]/goals/scenarios.client.vue | 27 +- .../[slug]/goals/stakeholders.client.vue | 7 +- .../[slug]/system/functionality.client.vue | 9 +- .../[slug]/system/scenarios.client.vue | 27 +- pages/solution/new-entry.client.vue | 2 +- server/api/assumptions/[id].delete.ts | 10 +- server/api/assumptions/[id].get.ts | 10 +- server/api/assumptions/[id].put.ts | 37 +- server/api/assumptions/index.get.ts | 16 +- server/api/assumptions/index.post.ts | 28 +- server/api/constraints/[id].delete.ts | 10 +- server/api/constraints/[id].get.ts | 10 +- server/api/constraints/[id].put.ts | 35 +- server/api/constraints/index.get.ts | 18 +- server/api/constraints/index.post.ts | 28 +- server/api/effects/[id].delete.ts | 12 +- server/api/effects/[id].get.ts | 10 +- server/api/effects/[id].put.ts | 43 +- server/api/effects/index.get.ts | 16 +- server/api/effects/index.post.ts | 28 +- .../api/environment-components/[id].delete.ts | 12 +- server/api/environment-components/[id].get.ts | 12 +- server/api/environment-components/[id].put.ts | 39 +- .../api/environment-components/index.get.ts | 21 +- .../api/environment-components/index.post.ts | 32 +- .../api/functional-behaviors/[id].delete.ts | 13 +- server/api/functional-behaviors/[id].get.ts | 13 +- server/api/functional-behaviors/[id].put.ts | 37 +- server/api/functional-behaviors/index.get.ts | 19 +- server/api/functional-behaviors/index.post.ts | 28 +- server/api/glossary-terms/[id].delete.ts | 11 +- server/api/glossary-terms/[id].get.ts | 10 +- server/api/glossary-terms/[id].put.ts | 36 +- server/api/glossary-terms/index.get.ts | 16 +- server/api/glossary-terms/index.post.ts | 25 +- server/api/goals/[id].delete.ts | 20 - server/api/goals/[id].put.ts | 46 - server/api/goals/index.get.ts | 36 - server/api/goals/index.post.ts | 37 - server/api/invariants/[id].delete.ts | 10 +- server/api/invariants/[id].get.ts | 10 +- server/api/invariants/[id].put.ts | 32 +- server/api/invariants/index.get.ts | 16 +- server/api/invariants/index.post.ts | 23 +- server/api/justifications/[id].delete.ts | 18 + .../api/{goals => justifications}/[id].get.ts | 12 +- server/api/justifications/[id].put.ts | 53 + server/api/justifications/index.get.ts | 38 + server/api/justifications/index.post.ts | 41 + server/api/limits/[id].delete.ts | 10 +- server/api/limits/[id].get.ts | 10 +- server/api/limits/[id].put.ts | 38 +- server/api/limits/index.get.ts | 16 +- server/api/limits/index.post.ts | 28 +- .../non-functional-behaviors/[id].delete.ts | 13 +- .../api/non-functional-behaviors/[id].get.ts | 13 +- .../api/non-functional-behaviors/[id].put.ts | 37 +- .../api/non-functional-behaviors/index.get.ts | 19 +- .../non-functional-behaviors/index.post.ts | 28 +- server/api/obstacles/[id].delete.ts | 10 +- server/api/obstacles/[id].get.ts | 10 +- server/api/obstacles/[id].put.ts | 37 +- server/api/obstacles/index.get.ts | 16 +- server/api/obstacles/index.post.ts | 28 +- server/api/outcomes/[id].delete.ts | 10 +- server/api/outcomes/[id].get.ts | 10 +- server/api/outcomes/[id].put.ts | 31 +- server/api/outcomes/index.get.ts | 16 +- server/api/outcomes/index.post.ts | 28 +- server/api/persons/[id].delete.ts | 10 +- server/api/persons/[id].get.ts | 10 +- server/api/persons/[id].put.ts | 34 +- server/api/persons/index.get.ts | 16 +- server/api/persons/index.post.ts | 25 +- server/api/solutions/[id].delete.ts | 10 +- server/api/solutions/[id].get.ts | 10 +- server/api/solutions/[id].put.ts | 25 +- server/api/solutions/index.get.ts | 17 +- server/api/solutions/index.post.ts | 17 +- server/api/stakeholders/[id].delete.ts | 10 +- server/api/stakeholders/[id].get.ts | 10 +- server/api/stakeholders/[id].put.ts | 56 +- server/api/stakeholders/index.get.ts | 26 +- server/api/stakeholders/index.post.ts | 48 +- server/api/system-components/[id].delete.ts | 12 +- server/api/system-components/[id].get.ts | 12 +- server/api/system-components/[id].put.ts | 39 +- server/api/system-components/index.get.ts | 18 +- server/api/system-components/index.post.ts | 35 +- server/api/use-cases/[id].delete.ts | 10 +- server/api/use-cases/[id].get.ts | 10 +- server/api/use-cases/[id].put.ts | 79 +- server/api/use-cases/index.get.ts | 22 +- server/api/use-cases/index.post.ts | 62 +- server/api/user-stories/[id].delete.ts | 10 +- server/api/user-stories/[id].get.ts | 10 +- server/api/user-stories/[id].put.ts | 64 +- server/api/user-stories/index.get.ts | 19 +- server/api/user-stories/index.post.ts | 57 +- server/application/AssumptionInteractor.ts | 9 - server/application/ComponentInteractor.ts | 9 - server/application/ConstraintInteractor.ts | 9 - server/application/EffectInteractor.ts | 9 - .../EnvironmentComponentInteractor.ts | 9 - .../FunctionalBehaviorInteractor.ts | 9 - server/application/GlossaryTermInteractor.ts | 9 - server/application/GoalInteractor.ts | 9 - server/application/Interactor.ts | 31 - server/application/InvariantInteractor.ts | 9 - server/application/LimitInteractor.ts | 9 - .../NonFunctionalBehaviorInteractor.ts | 9 - server/application/ObstacleInteractor.ts | 9 - server/application/OutcomeInteractor.ts | 9 - server/application/PersonInteractor.ts | 9 - server/application/Repository.ts | 41 - server/application/SolutionInteractor.ts | 9 - server/application/StakeholderInteractor.ts | 9 - .../application/SystemComponentInteractor.ts | 9 - server/application/UseCaseInteractor.ts | 9 - server/application/UserStoryInteractor.ts | 9 - server/data/db.ts | 39 - server/data/orm.ts | 4 + .../data/repositories/AssumptionRepository.ts | 74 - .../data/repositories/ComponentRepository.ts | 89 - .../data/repositories/ConstraintRepository.ts | 85 - server/data/repositories/EffectRepository.ts | 75 - .../EnvironmentComponentRepository.ts | 97 - .../FunctionalBehaviorRepository.ts | 93 - .../repositories/GlossaryTermRepository.ts | 93 - server/data/repositories/GoalRepository.ts | 74 - .../data/repositories/InvariantRepository.ts | 76 - server/data/repositories/LimitRepository.ts | 76 - .../NonFunctionalBehaviorRepository.ts | 94 - .../data/repositories/ObstacleRepository.ts | 80 - server/data/repositories/OutcomeRepository.ts | 80 - server/data/repositories/PersonRepository.ts | 89 - .../data/repositories/PostgresRepository.ts | 33 - .../data/repositories/SolutionRepository.ts | 71 - .../repositories/StakeholderRepository.ts | 128 -- .../repositories/SystemComponentRepository.ts | 100 - server/data/repositories/UseCaseRepository.ts | 170 -- .../data/repositories/UserStoryRepository.ts | 129 -- server/domain/Actor.ts | 4 +- server/domain/Assumption.ts | 4 +- server/domain/Behavior.ts | 28 +- server/domain/Component.ts | 21 +- server/domain/Constraint.ts | 30 +- server/domain/ConstraintCategory.ts | 25 - server/domain/Effect.ts | 4 +- server/domain/Entity.ts | 25 - server/domain/EnvironmentComponent.ts | 17 +- server/domain/Equatable.ts | 8 - server/domain/Example.ts | 4 +- server/domain/FunctionalBehavior.ts | 4 +- server/domain/Functionality.ts | 4 +- server/domain/GlossaryTerm.ts | 14 +- server/domain/Goal.ts | 5 +- server/domain/Goals.ts | 33 - server/domain/Hint.ts | 4 +- server/domain/Invariant.ts | 4 +- server/domain/Justification.ts | 4 +- server/domain/Limit.ts | 6 +- server/domain/MetaRequirement.ts | 4 +- server/domain/MoscowPriority.ts | 34 +- server/domain/Noise.ts | 2 +- server/domain/NonFunctionalBehavior.ts | 4 +- server/domain/Obstacle.ts | 4 +- server/domain/Outcome.ts | 4 +- server/domain/PEGS.ts | 24 - server/domain/Person.ts | 20 +- server/domain/Product.ts | 4 +- server/domain/Requirement.ts | 38 +- server/domain/Scenario.ts | 23 +- server/domain/Solution.ts | 10 +- server/domain/Stakeholder.ts | 78 +- server/domain/StakeholderCategory.ts | 26 - server/domain/StakeholderSegmentation.ts | 24 - server/domain/SystemComponent.ts | 14 +- server/domain/UseCase.ts | 45 +- server/domain/UserStory.ts | 29 +- server/domain/ValueObject.ts | 17 - server/npm-scripts.ts | 118 -- temp/Solution.ts.json | 1 - 196 files changed, 3486 insertions(+), 3636 deletions(-) delete mode 100644 migrations/Migration20240719152506.ts create mode 100644 migrations/Migration20240720212912.ts delete mode 100644 server/api/goals/[id].delete.ts delete mode 100644 server/api/goals/[id].put.ts delete mode 100644 server/api/goals/index.get.ts delete mode 100644 server/api/goals/index.post.ts create mode 100644 server/api/justifications/[id].delete.ts rename server/api/{goals => justifications}/[id].get.ts (54%) create mode 100644 server/api/justifications/[id].put.ts create mode 100644 server/api/justifications/index.get.ts create mode 100644 server/api/justifications/index.post.ts delete mode 100644 server/application/AssumptionInteractor.ts delete mode 100644 server/application/ComponentInteractor.ts delete mode 100644 server/application/ConstraintInteractor.ts delete mode 100644 server/application/EffectInteractor.ts delete mode 100644 server/application/EnvironmentComponentInteractor.ts delete mode 100644 server/application/FunctionalBehaviorInteractor.ts delete mode 100644 server/application/GlossaryTermInteractor.ts delete mode 100644 server/application/GoalInteractor.ts delete mode 100644 server/application/Interactor.ts delete mode 100644 server/application/InvariantInteractor.ts delete mode 100644 server/application/LimitInteractor.ts delete mode 100644 server/application/NonFunctionalBehaviorInteractor.ts delete mode 100644 server/application/ObstacleInteractor.ts delete mode 100644 server/application/OutcomeInteractor.ts delete mode 100644 server/application/PersonInteractor.ts delete mode 100644 server/application/Repository.ts delete mode 100644 server/application/SolutionInteractor.ts delete mode 100644 server/application/StakeholderInteractor.ts delete mode 100644 server/application/SystemComponentInteractor.ts delete mode 100644 server/application/UseCaseInteractor.ts delete mode 100644 server/application/UserStoryInteractor.ts delete mode 100644 server/data/db.ts create mode 100644 server/data/orm.ts delete mode 100644 server/data/repositories/AssumptionRepository.ts delete mode 100644 server/data/repositories/ComponentRepository.ts delete mode 100644 server/data/repositories/ConstraintRepository.ts delete mode 100644 server/data/repositories/EffectRepository.ts delete mode 100644 server/data/repositories/EnvironmentComponentRepository.ts delete mode 100644 server/data/repositories/FunctionalBehaviorRepository.ts delete mode 100644 server/data/repositories/GlossaryTermRepository.ts delete mode 100644 server/data/repositories/GoalRepository.ts delete mode 100644 server/data/repositories/InvariantRepository.ts delete mode 100644 server/data/repositories/LimitRepository.ts delete mode 100644 server/data/repositories/NonFunctionalBehaviorRepository.ts delete mode 100644 server/data/repositories/ObstacleRepository.ts delete mode 100644 server/data/repositories/OutcomeRepository.ts delete mode 100644 server/data/repositories/PersonRepository.ts delete mode 100644 server/data/repositories/PostgresRepository.ts delete mode 100644 server/data/repositories/SolutionRepository.ts delete mode 100644 server/data/repositories/StakeholderRepository.ts delete mode 100644 server/data/repositories/SystemComponentRepository.ts delete mode 100644 server/data/repositories/UseCaseRepository.ts delete mode 100644 server/data/repositories/UserStoryRepository.ts delete mode 100644 server/domain/ConstraintCategory.ts delete mode 100644 server/domain/Entity.ts delete mode 100644 server/domain/Equatable.ts delete mode 100644 server/domain/Goals.ts delete mode 100644 server/domain/PEGS.ts delete mode 100644 server/domain/StakeholderCategory.ts delete mode 100644 server/domain/StakeholderSegmentation.ts delete mode 100644 server/domain/ValueObject.ts delete mode 100644 server/npm-scripts.ts delete mode 100644 temp/Solution.ts.json diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 64a1db51..42b88ed5 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -46,6 +46,8 @@ jobs: # rm package-lock.json - name: Install dependencies run: npm install + - name: Typecheck + run: npm run typecheck - name: Build Application run: npm run build - name: Generate PWA Assets diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fd02c0a..31def6b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,8 @@ jobs: # rm package-lock.json - name: Install dependencies run: npm install + - name: Typecheck + run: npm run typecheck - name: Build Application run: npm run build - name: Generate PWA Assets diff --git a/.gitignore b/.gitignore index b9e22af5..3fbb0d17 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ logs public/apple-touch-icon-*.png public/favicon.ico public/maskable-icon-*.png -public/pwa-*.png \ No newline at end of file +public/pwa-*.png + +# mikro-orm +temp \ No newline at end of file diff --git a/migrations/.snapshot-cathedral.json b/migrations/.snapshot-cathedral.json index bf160061..9fe41027 100644 --- a/migrations/.snapshot-cathedral.json +++ b/migrations/.snapshot-cathedral.json @@ -73,6 +73,1697 @@ "checks": [], "foreignKeys": {}, "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "product", + "schema": "public", + "indexes": [ + { + "keyName": "product_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "product_solution_id_foreign": { + "constraintName": "product_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.product", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "email": { + "name": "email", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + } + }, + "name": "person", + "schema": "public", + "indexes": [ + { + "keyName": "person_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "person_solution_id_foreign": { + "constraintName": "person_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.person", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "outcome", + "schema": "public", + "indexes": [ + { + "keyName": "outcome_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "outcome_solution_id_foreign": { + "constraintName": "outcome_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.outcome", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "obstacle", + "schema": "public", + "indexes": [ + { + "keyName": "obstacle_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "obstacle_solution_id_foreign": { + "constraintName": "obstacle_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.obstacle", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "priority": { + "name": "priority", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "MUST", + "SHOULD", + "COULD", + "WONT" + ], + "mappedType": "enum" + } + }, + "name": "non_functional_behavior", + "schema": "public", + "indexes": [ + { + "keyName": "non_functional_behavior_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "non_functional_behavior_solution_id_foreign": { + "constraintName": "non_functional_behavior_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.non_functional_behavior", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "limit", + "schema": "public", + "indexes": [ + { + "keyName": "limit_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "limit_solution_id_foreign": { + "constraintName": "limit_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.limit", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "justification", + "schema": "public", + "indexes": [ + { + "keyName": "justification_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "justification_solution_id_foreign": { + "constraintName": "justification_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.justification", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "invariant", + "schema": "public", + "indexes": [ + { + "keyName": "invariant_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "invariant_solution_id_foreign": { + "constraintName": "invariant_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.invariant", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "hint", + "schema": "public", + "indexes": [ + { + "keyName": "hint_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "hint_solution_id_foreign": { + "constraintName": "hint_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.hint", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "parent_component_id": { + "name": "parent_component_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + } + }, + "name": "glossary_term", + "schema": "public", + "indexes": [ + { + "keyName": "glossary_term_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "glossary_term_solution_id_foreign": { + "constraintName": "glossary_term_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.glossary_term", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + }, + "glossary_term_parent_component_id_foreign": { + "constraintName": "glossary_term_parent_component_id_foreign", + "columnNames": [ + "parent_component_id" + ], + "localTableName": "public.glossary_term", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.glossary_term", + "deleteRule": "set null", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "priority": { + "name": "priority", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "MUST", + "SHOULD", + "COULD", + "WONT" + ], + "mappedType": "enum" + } + }, + "name": "functional_behavior", + "schema": "public", + "indexes": [ + { + "keyName": "functional_behavior_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "functional_behavior_solution_id_foreign": { + "constraintName": "functional_behavior_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.functional_behavior", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "parent_component_id": { + "name": "parent_component_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + } + }, + "name": "environment_component", + "schema": "public", + "indexes": [ + { + "keyName": "environment_component_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "environment_component_solution_id_foreign": { + "constraintName": "environment_component_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.environment_component", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + }, + "environment_component_parent_component_id_foreign": { + "constraintName": "environment_component_parent_component_id_foreign", + "columnNames": [ + "parent_component_id" + ], + "localTableName": "public.environment_component", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.environment_component", + "deleteRule": "set null", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "effect", + "schema": "public", + "indexes": [ + { + "keyName": "effect_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "effect_solution_id_foreign": { + "constraintName": "effect_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.effect", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "category": { + "name": "category", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "Business Rule", + "Physical Law", + "Engineering Decision" + ], + "mappedType": "enum" + } + }, + "name": "constraint", + "schema": "public", + "indexes": [ + { + "keyName": "constraint_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "constraint_solution_id_foreign": { + "constraintName": "constraint_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.constraint", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "assumption", + "schema": "public", + "indexes": [ + { + "keyName": "assumption_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "assumption_solution_id_foreign": { + "constraintName": "assumption_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.assumption", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "parent_component_id": { + "name": "parent_component_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + }, + "segmentation": { + "name": "segmentation", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "Client", + "Vendor" + ], + "mappedType": "enum" + }, + "category": { + "name": "category", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "Key Stakeholder", + "Shadow Influencer", + "Fellow Traveler", + "Observer" + ], + "mappedType": "enum" + }, + "availability": { + "name": "availability", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "influence": { + "name": "influence", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + } + }, + "name": "stakeholder", + "schema": "public", + "indexes": [ + { + "keyName": "stakeholder_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [ + { + "name": "stakeholder_availability_check", + "expression": "availability >= 0 AND availability <= 100", + "definition": "check ((availability >= 0 AND availability <= 100))", + "columnName": "availability" + }, + { + "name": "stakeholder_influence_check", + "expression": "influence >= 0 AND influence <= 100", + "definition": "check ((influence >= 0 AND influence <= 100))", + "columnName": "influence" + } + ], + "foreignKeys": { + "stakeholder_solution_id_foreign": { + "constraintName": "stakeholder_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.stakeholder", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + }, + "stakeholder_parent_component_id_foreign": { + "constraintName": "stakeholder_parent_component_id_foreign", + "columnNames": [ + "parent_component_id" + ], + "localTableName": "public.stakeholder", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.stakeholder", + "deleteRule": "set null", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "priority": { + "name": "priority", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "MUST", + "SHOULD", + "COULD", + "WONT" + ], + "mappedType": "enum" + }, + "primary_actor_id": { + "name": "primary_actor_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "level": { + "name": "level", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "goal_in_context": { + "name": "goal_in_context", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "precondition_id": { + "name": "precondition_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "trigger_id": { + "name": "trigger_id", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "main_success_scenario": { + "name": "main_success_scenario", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "success_guarantee_id": { + "name": "success_guarantee_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "extensions": { + "name": "extensions", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + } + }, + "name": "use_case", + "schema": "public", + "indexes": [ + { + "keyName": "use_case_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "use_case_solution_id_foreign": { + "constraintName": "use_case_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.use_case", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + }, + "use_case_primary_actor_id_foreign": { + "constraintName": "use_case_primary_actor_id_foreign", + "columnNames": [ + "primary_actor_id" + ], + "localTableName": "public.use_case", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.stakeholder", + "updateRule": "cascade" + }, + "use_case_precondition_id_foreign": { + "constraintName": "use_case_precondition_id_foreign", + "columnNames": [ + "precondition_id" + ], + "localTableName": "public.use_case", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.assumption", + "updateRule": "cascade" + }, + "use_case_success_guarantee_id_foreign": { + "constraintName": "use_case_success_guarantee_id_foreign", + "columnNames": [ + "success_guarantee_id" + ], + "localTableName": "public.use_case", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.effect", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "statement": { + "name": "statement", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + }, + "solution_id": { + "name": "solution_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "priority": { + "name": "priority", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "MUST", + "SHOULD", + "COULD", + "WONT" + ], + "mappedType": "enum" + }, + "primary_actor_id": { + "name": "primary_actor_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "functional_behavior_id": { + "name": "functional_behavior_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + }, + "outcome_id": { + "name": "outcome_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "uuid" + } + }, + "name": "user_story", + "schema": "public", + "indexes": [ + { + "keyName": "user_story_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "user_story_solution_id_foreign": { + "constraintName": "user_story_solution_id_foreign", + "columnNames": [ + "solution_id" + ], + "localTableName": "public.user_story", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.solution", + "updateRule": "cascade" + }, + "user_story_primary_actor_id_foreign": { + "constraintName": "user_story_primary_actor_id_foreign", + "columnNames": [ + "primary_actor_id" + ], + "localTableName": "public.user_story", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.stakeholder", + "updateRule": "cascade" + }, + "user_story_functional_behavior_id_foreign": { + "constraintName": "user_story_functional_behavior_id_foreign", + "columnNames": [ + "functional_behavior_id" + ], + "localTableName": "public.user_story", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.functional_behavior", + "updateRule": "cascade" + }, + "user_story_outcome_id_foreign": { + "constraintName": "user_story_outcome_id_foreign", + "columnNames": [ + "outcome_id" + ], + "localTableName": "public.user_story", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.outcome", + "updateRule": "cascade" + } + }, + "nativeEnums": {} } ], "nativeEnums": {} diff --git a/migrations/Migration20240719152506.ts b/migrations/Migration20240719152506.ts deleted file mode 100644 index 75a28231..00000000 --- a/migrations/Migration20240719152506.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Migration } from '@mikro-orm/migrations'; - -export class Migration20240719152506 extends Migration { - - async up(): Promise { - this.addSql('create table "solution" ("id" uuid not null, "description" varchar(255) not null, "name" varchar(60) not null, "slug" varchar(255) not null, constraint "solution_pkey" primary key ("id"));'); - this.addSql('alter table "solution" add constraint "solution_slug_unique" unique ("slug");'); - } - -} diff --git a/migrations/Migration20240720212912.ts b/migrations/Migration20240720212912.ts new file mode 100644 index 00000000..80a14e41 --- /dev/null +++ b/migrations/Migration20240720212912.ts @@ -0,0 +1,144 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20240720212912 extends Migration { + + async up(): Promise { + this.addSql('create table "product" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "product_pkey" primary key ("id"));'); + + this.addSql('create table "person" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "email" varchar(255) not null, constraint "person_pkey" primary key ("id"));'); + + this.addSql('create table "outcome" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "outcome_pkey" primary key ("id"));'); + + this.addSql('create table "obstacle" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "obstacle_pkey" primary key ("id"));'); + + this.addSql('create table "non_functional_behavior" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "priority" text check ("priority" in (\'MUST\', \'SHOULD\', \'COULD\', \'WONT\')) not null, constraint "non_functional_behavior_pkey" primary key ("id"));'); + + this.addSql('create table "limit" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "limit_pkey" primary key ("id"));'); + + this.addSql('create table "justification" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "justification_pkey" primary key ("id"));'); + + this.addSql('create table "invariant" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "invariant_pkey" primary key ("id"));'); + + this.addSql('create table "hint" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "hint_pkey" primary key ("id"));'); + + this.addSql('create table "glossary_term" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "parent_component_id" uuid null, constraint "glossary_term_pkey" primary key ("id"));'); + + this.addSql('create table "functional_behavior" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "priority" text check ("priority" in (\'MUST\', \'SHOULD\', \'COULD\', \'WONT\')) not null, constraint "functional_behavior_pkey" primary key ("id"));'); + + this.addSql('create table "environment_component" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "parent_component_id" uuid null, constraint "environment_component_pkey" primary key ("id"));'); + + this.addSql('create table "effect" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "effect_pkey" primary key ("id"));'); + + this.addSql('create table "constraint" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "category" text check ("category" in (\'Business Rule\', \'Physical Law\', \'Engineering Decision\')) not null, constraint "constraint_pkey" primary key ("id"));'); + + this.addSql('create table "assumption" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, constraint "assumption_pkey" primary key ("id"));'); + + this.addSql('create table "stakeholder" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "parent_component_id" uuid null, "segmentation" text check ("segmentation" in (\'Client\', \'Vendor\')) not null, "category" text check ("category" in (\'Key Stakeholder\', \'Shadow Influencer\', \'Fellow Traveler\', \'Observer\')) not null, "availability" int not null, "influence" int not null, constraint "stakeholder_pkey" primary key ("id"), constraint stakeholder_availability_check check (availability >= 0 AND availability <= 100), constraint stakeholder_influence_check check (influence >= 0 AND influence <= 100));'); + + this.addSql('create table "use_case" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "priority" text check ("priority" in (\'MUST\', \'SHOULD\', \'COULD\', \'WONT\')) not null, "primary_actor_id" uuid not null, "scope" varchar(255) not null, "level" varchar(255) not null, "goal_in_context" varchar(255) not null, "precondition_id" uuid not null, "trigger_id" varchar(255) not null, "main_success_scenario" varchar(255) not null, "success_guarantee_id" uuid not null, "extensions" varchar(255) not null, constraint "use_case_pkey" primary key ("id"));'); + + this.addSql('create table "user_story" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(255) not null, "solution_id" uuid not null, "priority" text check ("priority" in (\'MUST\', \'SHOULD\', \'COULD\', \'WONT\')) not null, "primary_actor_id" uuid not null, "functional_behavior_id" uuid not null, "outcome_id" uuid not null, constraint "user_story_pkey" primary key ("id"));'); + + this.addSql('alter table "product" add constraint "product_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "person" add constraint "person_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "outcome" add constraint "outcome_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "obstacle" add constraint "obstacle_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "non_functional_behavior" add constraint "non_functional_behavior_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "limit" add constraint "limit_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "justification" add constraint "justification_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "invariant" add constraint "invariant_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "hint" add constraint "hint_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "glossary_term" add constraint "glossary_term_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + this.addSql('alter table "glossary_term" add constraint "glossary_term_parent_component_id_foreign" foreign key ("parent_component_id") references "glossary_term" ("id") on update cascade on delete set null;'); + + this.addSql('alter table "functional_behavior" add constraint "functional_behavior_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "environment_component" add constraint "environment_component_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + this.addSql('alter table "environment_component" add constraint "environment_component_parent_component_id_foreign" foreign key ("parent_component_id") references "environment_component" ("id") on update cascade on delete set null;'); + + this.addSql('alter table "effect" add constraint "effect_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "constraint" add constraint "constraint_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "assumption" add constraint "assumption_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + + this.addSql('alter table "stakeholder" add constraint "stakeholder_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + this.addSql('alter table "stakeholder" add constraint "stakeholder_parent_component_id_foreign" foreign key ("parent_component_id") references "stakeholder" ("id") on update cascade on delete set null;'); + + this.addSql('alter table "use_case" add constraint "use_case_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + this.addSql('alter table "use_case" add constraint "use_case_primary_actor_id_foreign" foreign key ("primary_actor_id") references "stakeholder" ("id") on update cascade;'); + this.addSql('alter table "use_case" add constraint "use_case_precondition_id_foreign" foreign key ("precondition_id") references "assumption" ("id") on update cascade;'); + this.addSql('alter table "use_case" add constraint "use_case_success_guarantee_id_foreign" foreign key ("success_guarantee_id") references "effect" ("id") on update cascade;'); + + this.addSql('alter table "user_story" add constraint "user_story_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;'); + this.addSql('alter table "user_story" add constraint "user_story_primary_actor_id_foreign" foreign key ("primary_actor_id") references "stakeholder" ("id") on update cascade;'); + this.addSql('alter table "user_story" add constraint "user_story_functional_behavior_id_foreign" foreign key ("functional_behavior_id") references "functional_behavior" ("id") on update cascade;'); + this.addSql('alter table "user_story" add constraint "user_story_outcome_id_foreign" foreign key ("outcome_id") references "outcome" ("id") on update cascade;'); + } + + async down(): Promise { + this.addSql('alter table "user_story" drop constraint "user_story_outcome_id_foreign";'); + + this.addSql('alter table "glossary_term" drop constraint "glossary_term_parent_component_id_foreign";'); + + this.addSql('alter table "user_story" drop constraint "user_story_functional_behavior_id_foreign";'); + + this.addSql('alter table "environment_component" drop constraint "environment_component_parent_component_id_foreign";'); + + this.addSql('alter table "use_case" drop constraint "use_case_success_guarantee_id_foreign";'); + + this.addSql('alter table "use_case" drop constraint "use_case_precondition_id_foreign";'); + + this.addSql('alter table "stakeholder" drop constraint "stakeholder_parent_component_id_foreign";'); + + this.addSql('alter table "use_case" drop constraint "use_case_primary_actor_id_foreign";'); + + this.addSql('alter table "user_story" drop constraint "user_story_primary_actor_id_foreign";'); + + this.addSql('drop table if exists "product" cascade;'); + + this.addSql('drop table if exists "person" cascade;'); + + this.addSql('drop table if exists "outcome" cascade;'); + + this.addSql('drop table if exists "obstacle" cascade;'); + + this.addSql('drop table if exists "non_functional_behavior" cascade;'); + + this.addSql('drop table if exists "limit" cascade;'); + + this.addSql('drop table if exists "justification" cascade;'); + + this.addSql('drop table if exists "invariant" cascade;'); + + this.addSql('drop table if exists "hint" cascade;'); + + this.addSql('drop table if exists "glossary_term" cascade;'); + + this.addSql('drop table if exists "functional_behavior" cascade;'); + + this.addSql('drop table if exists "environment_component" cascade;'); + + this.addSql('drop table if exists "effect" cascade;'); + + this.addSql('drop table if exists "constraint" cascade;'); + + this.addSql('drop table if exists "assumption" cascade;'); + + this.addSql('drop table if exists "stakeholder" cascade;'); + + this.addSql('drop table if exists "use_case" cascade;'); + + this.addSql('drop table if exists "user_story" cascade;'); + } + +} diff --git a/mikro-orm.config.ts b/mikro-orm.config.ts index ab5fb6fa..5cb6d6a4 100644 --- a/mikro-orm.config.ts +++ b/mikro-orm.config.ts @@ -1,21 +1,47 @@ +// This file is referenced by the application as well as the migration CLI +// The CLI use case requires the direct and indirect imports to have a .js extension. +// Additionally, the imports can not use '~' import dotenv from "dotenv"; import { type Options, PostgreSqlDriver } from '@mikro-orm/postgresql'; import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; +import { Migrator } from '@mikro-orm/migrations'; import Solution from './server/domain/Solution.js'; +import Actor from "./server/domain/Actor.js"; +import Assumption from "./server/domain/Assumption.js"; +import Constraint from "./server/domain/Constraint.js"; +import Effect from "./server/domain/Effect.js"; +import EnvironmentComponent from "./server/domain/EnvironmentComponent.js"; +import FunctionalBehavior from "./server/domain/FunctionalBehavior.js"; +import GlossaryTerm from "./server/domain/GlossaryTerm.js"; +import Justification from "./server/domain/Justification.js"; +import Hint from "./server/domain/Hint.js"; +import Invariant from "./server/domain/Invariant.js"; +import Limit from "./server/domain/Limit.js"; +import NonFunctionalBehavior from "./server/domain/NonFunctionalBehavior.js"; +import Obstacle from "./server/domain/Obstacle.js"; +import Outcome from "./server/domain/Outcome.js"; +import Person from "./server/domain/Person.js"; +import Product from "./server/domain/Product.js"; +import Stakeholder from "./server/domain/Stakeholder.js"; +import UseCase from "./server/domain/UseCase.js"; +import UserStory from "./server/domain/UserStory.js"; dotenv.config(); -console.log('CONFIG') -console.log(process.env.POSTGRES_DB) - const config: Options = { + extensions: [Migrator], driver: PostgreSqlDriver, dbName: process.env.POSTGRES_DB!, user: process.env.POSTGRES_USER!, host: process.env.POSTGRES_HOST!, password: process.env.POSTGRES_PASSWORD!, port: parseInt(process.env.POSTGRES_PORT!), - entities: [Solution], + entities: [ + Solution, Actor, Assumption, Constraint, Effect, EnvironmentComponent, + FunctionalBehavior, GlossaryTerm, Justification, Hint, Invariant, Limit, + NonFunctionalBehavior, Obstacle, Outcome, Person, Product, Stakeholder, + UseCase, UserStory + ], forceUtcTimezone: true, // we will use the ts-morph reflection, an alternative to the default reflect-metadata provider // check the documentation for their differences: https://mikro-orm.io/docs/metadata-providers diff --git a/nuxt.config.ts b/nuxt.config.ts index 6431fec6..330b68ff 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -37,6 +37,12 @@ export default defineNuxtConfig({ modules: ["nuxt-primevue", "@vite-pwa/nuxt"], nitro: { preset: 'node-server', + // ref: https://github.com/nuxt/nuxt/issues/21756 + esbuild: { + options: { + target: 'esnext' + } + }, experimental: { // https://nitro.unjs.io/config#openapi openAPI: true @@ -67,6 +73,14 @@ export default defineNuxtConfig({ typeCheck: false }, vite: { - + esbuild: { + tsconfigRaw: { + compilerOptions: { + experimentalDecorators: true, + // @ts-ignore + emitDecoratorMetadata: true + } + } + } } }) \ No newline at end of file diff --git a/package.json b/package.json index 4baed503..6a881db3 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,13 @@ "dev": "nuxt dev --no-fork --inspect", "postinstall": "nuxt prepare", "typecheck": "nuxi typecheck", - "//migrate-up": "tsx server/npm-scripts.ts migrate-up", - "//migrate-down": "tsx server/npm-scripts.ts migrate-down", "orm-debug": "mikro-orm-esm debug", "orm-create-db": "mikro-orm-esm database:create", - "orm-create-initial-migration": "mikro-orm-esm migration:create --initial" + "orm-create-migration": "mikro-orm-esm migration:create", + "orm-list-pending-migrations": "mikro-orm-esm migration:pending", + "orm-list-executed-migrations": "mikro-orm-esm migration:list", + "orm-run-pending-migrations": "mikro-orm-esm migration:up", + "orm-rollback-migration": "mikro-orm-esm migration:down" }, "dependencies": { "@mikro-orm/core": "^6.3.0", @@ -57,4 +59,4 @@ "typescript": "^5.4.5", "vue-tsc": "^1.8.27" } -} +} \ No newline at end of file diff --git a/pages/solution/[slug]/edit-entry.client.vue b/pages/solution/[slug]/edit-entry.client.vue index c538ee9d..61d540c4 100644 --- a/pages/solution/[slug]/edit-entry.client.vue +++ b/pages/solution/[slug]/edit-entry.client.vue @@ -54,7 +54,7 @@ watch(() => solution.value.name, (newName) => {
+ class="w-23rem" v-model.trim="solution.description" />
diff --git a/pages/solution/[slug]/environment/constraints.client.vue b/pages/solution/[slug]/environment/constraints.client.vue index 6ecac01d..3aff3585 100644 --- a/pages/solution/[slug]/environment/constraints.client.vue +++ b/pages/solution/[slug]/environment/constraints.client.vue @@ -2,7 +2,7 @@ import { useFetch } from 'nuxt/app'; import { FilterMatchMode } from 'primevue/api'; import type Constraint from '~/server/domain/Constraint'; -import ConstraintCategory from '~/server/domain/ConstraintCategory'; +import ConstraintCategory from '~/server/domain/Constraint'; import { type Uuid, emptyUuid } from '~/server/domain/Uuid'; useHead({ title: 'Constraints' }) diff --git a/pages/solution/[slug]/goals/functionality.client.vue b/pages/solution/[slug]/goals/functionality.client.vue index 01833505..ae11dfcc 100644 --- a/pages/solution/[slug]/goals/functionality.client.vue +++ b/pages/solution/[slug]/goals/functionality.client.vue @@ -1,6 +1,7 @@