From 7e3253f16c4a9be2311df7d99c36aadee0cee919 Mon Sep 17 00:00:00 2001
From: Michael Haufe
Date: Sat, 28 Sep 2024 15:46:58 +0000
Subject: [PATCH] Defined nullable fields
---
components/XDataTable.vue | 12 +--
migrations/.snapshot-cathedral.json | 36 ++++----
migrations/Migration20240928152521.ts | 89 +++++++++++++++++++
mikro-orm.config.ts | 46 +++++-----
.../environment/assumptions.client.vue | 7 +-
.../environment/components.client.vue | 3 +-
.../goals/stakeholders.client.vue | 2 +-
.../project/roles-personnel.client.vue | 6 +-
server/api/assumptions/[id].put.ts | 4 +-
server/api/assumptions/index.post.ts | 4 +-
server/api/constraints/[id].put.ts | 6 +-
server/api/constraints/index.post.ts | 6 +-
server/api/effects/[id].put.ts | 4 +-
server/api/effects/index.post.ts | 4 +-
server/api/environment-components/[id].put.ts | 4 +-
.../api/environment-components/index.post.ts | 4 +-
server/api/functional-behaviors/[id].put.ts | 4 +-
server/api/functional-behaviors/index.post.ts | 4 +-
server/api/glossary-terms/[id].put.ts | 4 +-
server/api/glossary-terms/index.post.ts | 4 +-
server/api/invariants/[id].put.ts | 4 +-
server/api/invariants/index.post.ts | 4 +-
server/api/justifications/[id].put.ts | 4 +-
server/api/justifications/index.post.ts | 4 +-
server/api/limits/[id].put.ts | 4 +-
server/api/limits/index.post.ts | 4 +-
.../api/non-functional-behaviors/[id].put.ts | 6 +-
.../non-functional-behaviors/index.post.ts | 6 +-
server/api/obstacles/[id].put.ts | 4 +-
server/api/obstacles/index.post.ts | 4 +-
server/api/organizations/[id].put.ts | 4 +-
server/api/organizations/index.post.ts | 4 +-
server/api/outcomes/[id].put.ts | 4 +-
server/api/outcomes/index.post.ts | 4 +-
server/api/persons/[id].put.ts | 6 +-
server/api/persons/index.post.ts | 6 +-
server/api/stakeholders/[id].put.ts | 12 +--
server/api/stakeholders/index.post.ts | 12 +--
server/api/system-components/[id].put.ts | 4 +-
server/api/system-components/index.post.ts | 4 +-
server/api/use-cases/[id].put.ts | 52 ++++-------
server/api/use-cases/index.post.ts | 28 ++----
server/api/user-stories/[id].put.ts | 39 +++-----
server/api/user-stories/index.post.ts | 40 +++------
.../AppUserOrganizationRoleSchema.ts | 6 +-
.../models/{ => application}/AppUserSchema.ts | 2 +-
.../{ => application}/OrganizationSchema.ts | 2 +-
.../{ => application}/SolutionSchema.ts | 6 +-
.../{ => requirements}/AssumptionSchema.ts | 2 +-
.../{ => requirements}/BehaviorSchema.ts | 4 +-
.../{ => requirements}/ConstraintSchema.ts | 4 +-
.../models/{ => requirements}/EffectSchema.ts | 2 +-
.../EnvironmentComponentSchema.ts | 2 +-
.../FunctionalBehaviorSchema.ts | 2 +-
.../{ => requirements}/GlossaryTermSchema.ts | 2 +-
.../models/{ => requirements}/HintSchema.ts | 2 +-
.../{ => requirements}/InvariantSchema.ts | 2 +-
.../{ => requirements}/JustificationSchema.ts | 2 +-
.../models/{ => requirements}/LimitSchema.ts | 2 +-
.../NonFunctionalBehaviorSchema.ts | 2 +-
.../{ => requirements}/ObstacleSchema.ts | 2 +-
.../{ => requirements}/OutcomeSchema.ts | 2 +-
.../models/{ => requirements}/PersonSchema.ts | 4 +-
.../{ => requirements}/ProductSchema.ts | 2 +-
.../{ => requirements}/RequirementSchema.ts | 2 +-
.../{ => requirements}/ScenarioSchema.ts | 4 +-
.../{ => requirements}/StakeholderSchema.ts | 6 +-
.../SystemComponentSchema.ts | 2 +-
.../{ => requirements}/UseCaseSchema.ts | 8 +-
.../{ => requirements}/UserStorySchema.ts | 6 +-
server/domain/requirements/Behavior.ts | 2 +-
server/domain/requirements/Constraint.ts | 2 +-
server/domain/requirements/Person.ts | 2 +-
server/domain/requirements/Scenario.ts | 2 +-
server/domain/requirements/Stakeholder.ts | 4 +-
server/domain/requirements/UseCase.ts | 6 +-
server/domain/requirements/UserStory.ts | 4 +-
77 files changed, 326 insertions(+), 294 deletions(-)
create mode 100644 migrations/Migration20240928152521.ts
rename server/data/models/{ => application}/AppUserOrganizationRoleSchema.ts (71%)
rename server/data/models/{ => application}/AppUserSchema.ts (91%)
rename server/data/models/{ => application}/OrganizationSchema.ts (86%)
rename server/data/models/{ => application}/SolutionSchema.ts (93%)
rename server/data/models/{ => requirements}/AssumptionSchema.ts (73%)
rename server/data/models/{ => requirements}/BehaviorSchema.ts (60%)
rename server/data/models/{ => requirements}/ConstraintSchema.ts (87%)
rename server/data/models/{ => requirements}/EffectSchema.ts (73%)
rename server/data/models/{ => requirements}/EnvironmentComponentSchema.ts (79%)
rename server/data/models/{ => requirements}/FunctionalBehaviorSchema.ts (73%)
rename server/data/models/{ => requirements}/GlossaryTermSchema.ts (80%)
rename server/data/models/{ => requirements}/HintSchema.ts (74%)
rename server/data/models/{ => requirements}/InvariantSchema.ts (73%)
rename server/data/models/{ => requirements}/JustificationSchema.ts (72%)
rename server/data/models/{ => requirements}/LimitSchema.ts (73%)
rename server/data/models/{ => requirements}/NonFunctionalBehaviorSchema.ts (73%)
rename server/data/models/{ => requirements}/ObstacleSchema.ts (74%)
rename server/data/models/{ => requirements}/OutcomeSchema.ts (74%)
rename server/data/models/{ => requirements}/PersonSchema.ts (65%)
rename server/data/models/{ => requirements}/ProductSchema.ts (73%)
rename server/data/models/{ => requirements}/RequirementSchema.ts (92%)
rename server/data/models/{ => requirements}/ScenarioSchema.ts (78%)
rename server/data/models/{ => requirements}/StakeholderSchema.ts (88%)
rename server/data/models/{ => requirements}/SystemComponentSchema.ts (80%)
rename server/data/models/{ => requirements}/UseCaseSchema.ts (80%)
rename server/data/models/{ => requirements}/UserStorySchema.ts (63%)
diff --git a/components/XDataTable.vue b/components/XDataTable.vue
index 8617f24d..75a2883b 100644
--- a/components/XDataTable.vue
+++ b/components/XDataTable.vue
@@ -167,10 +167,10 @@ const onEditDialogCancel = () => {
-
+
+ v-model.trim="createDialogItem[key]" class="col-8" />
+ v-model.trim="createDialogItem[key]" class="col-8" />
{{ createDialogItem[key] }}
@@ -216,11 +216,11 @@ const onEditDialogCancel = () => {
Edit Item
diff --git a/migrations/.snapshot-cathedral.json b/migrations/.snapshot-cathedral.json
index 66382c9c..5ee3bac2 100644
--- a/migrations/.snapshot-cathedral.json
+++ b/migrations/.snapshot-cathedral.json
@@ -498,7 +498,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"length": 255,
"mappedType": "string"
}
@@ -823,7 +823,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"MUST",
"SHOULD",
@@ -1490,7 +1490,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"MUST",
"SHOULD",
@@ -1842,7 +1842,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"Business Rule",
"Physical Law",
@@ -2084,7 +2084,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"Client",
"Vendor"
@@ -2097,7 +2097,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"Key Stakeholder",
"Shadow Influencer",
@@ -2366,7 +2366,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"MUST",
"SHOULD",
@@ -2381,7 +2381,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
},
"scope": {
@@ -2420,7 +2420,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
},
"trigger_id": {
@@ -2429,7 +2429,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
},
"main_success_scenario": {
@@ -2448,7 +2448,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
},
"extensions": {
@@ -2512,6 +2512,7 @@
"id"
],
"referencedTableName": "public.stakeholder",
+ "deleteRule": "set null",
"updateRule": "cascade"
},
"use_case_precondition_id_foreign": {
@@ -2524,6 +2525,7 @@
"id"
],
"referencedTableName": "public.assumption",
+ "deleteRule": "set null",
"updateRule": "cascade"
},
"use_case_success_guarantee_id_foreign": {
@@ -2536,6 +2538,7 @@
"id"
],
"referencedTableName": "public.effect",
+ "deleteRule": "set null",
"updateRule": "cascade"
}
},
@@ -2608,7 +2611,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"enumItems": [
"MUST",
"SHOULD",
@@ -2623,7 +2626,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
},
"functional_behavior_id": {
@@ -2632,7 +2635,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
},
"outcome_id": {
@@ -2641,7 +2644,7 @@
"unsigned": false,
"autoincrement": false,
"primary": false,
- "nullable": false,
+ "nullable": true,
"mappedType": "uuid"
}
},
@@ -2695,6 +2698,7 @@
"id"
],
"referencedTableName": "public.stakeholder",
+ "deleteRule": "set null",
"updateRule": "cascade"
},
"user_story_functional_behavior_id_foreign": {
@@ -2707,6 +2711,7 @@
"id"
],
"referencedTableName": "public.functional_behavior",
+ "deleteRule": "set null",
"updateRule": "cascade"
},
"user_story_outcome_id_foreign": {
@@ -2719,6 +2724,7 @@
"id"
],
"referencedTableName": "public.outcome",
+ "deleteRule": "set null",
"updateRule": "cascade"
}
},
diff --git a/migrations/Migration20240928152521.ts b/migrations/Migration20240928152521.ts
new file mode 100644
index 00000000..5dacdac4
--- /dev/null
+++ b/migrations/Migration20240928152521.ts
@@ -0,0 +1,89 @@
+import { Migration } from '@mikro-orm/migrations';
+
+export class Migration20240928152521 extends Migration {
+
+ override async up(): Promise {
+ this.addSql(`alter table "use_case" drop constraint "use_case_primary_actor_id_foreign";`);
+ this.addSql(`alter table "use_case" drop constraint "use_case_precondition_id_foreign";`);
+ this.addSql(`alter table "use_case" drop constraint "use_case_success_guarantee_id_foreign";`);
+
+ this.addSql(`alter table "user_story" drop constraint "user_story_primary_actor_id_foreign";`);
+ this.addSql(`alter table "user_story" drop constraint "user_story_functional_behavior_id_foreign";`);
+ this.addSql(`alter table "user_story" drop constraint "user_story_outcome_id_foreign";`);
+
+ this.addSql(`alter table "person" alter column "email" type varchar(255) using ("email"::varchar(255));`);
+ this.addSql(`alter table "person" alter column "email" drop not null;`);
+
+ this.addSql(`alter table "use_case" alter column "primary_actor_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "primary_actor_id" type uuid using ("primary_actor_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "primary_actor_id" drop not null;`);
+ this.addSql(`alter table "use_case" alter column "precondition_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "precondition_id" type uuid using ("precondition_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "precondition_id" drop not null;`);
+ this.addSql(`alter table "use_case" alter column "trigger_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "trigger_id" type uuid using ("trigger_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "trigger_id" drop not null;`);
+ this.addSql(`alter table "use_case" alter column "success_guarantee_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "success_guarantee_id" type uuid using ("success_guarantee_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "success_guarantee_id" drop not null;`);
+ 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 on delete set null;`);
+ this.addSql(`alter table "use_case" add constraint "use_case_precondition_id_foreign" foreign key ("precondition_id") references "assumption" ("id") on update cascade on delete set null;`);
+ 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 on delete set null;`);
+
+ this.addSql(`alter table "user_story" alter column "primary_actor_id" drop default;`);
+ this.addSql(`alter table "user_story" alter column "primary_actor_id" type uuid using ("primary_actor_id"::text::uuid);`);
+ this.addSql(`alter table "user_story" alter column "primary_actor_id" drop not null;`);
+ this.addSql(`alter table "user_story" alter column "functional_behavior_id" drop default;`);
+ this.addSql(`alter table "user_story" alter column "functional_behavior_id" type uuid using ("functional_behavior_id"::text::uuid);`);
+ this.addSql(`alter table "user_story" alter column "functional_behavior_id" drop not null;`);
+ this.addSql(`alter table "user_story" alter column "outcome_id" drop default;`);
+ this.addSql(`alter table "user_story" alter column "outcome_id" type uuid using ("outcome_id"::text::uuid);`);
+ this.addSql(`alter table "user_story" alter column "outcome_id" drop not null;`);
+ 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 on delete set null;`);
+ 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 on delete set null;`);
+ this.addSql(`alter table "user_story" add constraint "user_story_outcome_id_foreign" foreign key ("outcome_id") references "outcome" ("id") on update cascade on delete set null;`);
+ }
+
+ override async down(): Promise {
+ this.addSql(`alter table "use_case" drop constraint "use_case_primary_actor_id_foreign";`);
+ this.addSql(`alter table "use_case" drop constraint "use_case_precondition_id_foreign";`);
+ this.addSql(`alter table "use_case" drop constraint "use_case_success_guarantee_id_foreign";`);
+
+ this.addSql(`alter table "user_story" drop constraint "user_story_primary_actor_id_foreign";`);
+ this.addSql(`alter table "user_story" drop constraint "user_story_functional_behavior_id_foreign";`);
+ this.addSql(`alter table "user_story" drop constraint "user_story_outcome_id_foreign";`);
+
+ this.addSql(`alter table "person" alter column "email" type varchar(255) using ("email"::varchar(255));`);
+ this.addSql(`alter table "person" alter column "email" set not null;`);
+
+ this.addSql(`alter table "use_case" alter column "primary_actor_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "primary_actor_id" type uuid using ("primary_actor_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "primary_actor_id" set not null;`);
+ this.addSql(`alter table "use_case" alter column "precondition_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "precondition_id" type uuid using ("precondition_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "precondition_id" set not null;`);
+ this.addSql(`alter table "use_case" alter column "trigger_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "trigger_id" type uuid using ("trigger_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "trigger_id" set not null;`);
+ this.addSql(`alter table "use_case" alter column "success_guarantee_id" drop default;`);
+ this.addSql(`alter table "use_case" alter column "success_guarantee_id" type uuid using ("success_guarantee_id"::text::uuid);`);
+ this.addSql(`alter table "use_case" alter column "success_guarantee_id" set not null;`);
+ 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" alter column "primary_actor_id" drop default;`);
+ this.addSql(`alter table "user_story" alter column "primary_actor_id" type uuid using ("primary_actor_id"::text::uuid);`);
+ this.addSql(`alter table "user_story" alter column "primary_actor_id" set not null;`);
+ this.addSql(`alter table "user_story" alter column "functional_behavior_id" drop default;`);
+ this.addSql(`alter table "user_story" alter column "functional_behavior_id" type uuid using ("functional_behavior_id"::text::uuid);`);
+ this.addSql(`alter table "user_story" alter column "functional_behavior_id" set not null;`);
+ this.addSql(`alter table "user_story" alter column "outcome_id" drop default;`);
+ this.addSql(`alter table "user_story" alter column "outcome_id" type uuid using ("outcome_id"::text::uuid);`);
+ this.addSql(`alter table "user_story" alter column "outcome_id" set not null;`);
+ 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;`);
+ }
+
+}
diff --git a/mikro-orm.config.ts b/mikro-orm.config.ts
index adf0bcb0..29583e31 100644
--- a/mikro-orm.config.ts
+++ b/mikro-orm.config.ts
@@ -5,29 +5,29 @@ 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 AssumptionSchema from "./server/data/models/AssumptionSchema.js";
-import ConstraintSchema from "./server/data/models/ConstraintSchema.js";
-import EffectSchema from "./server/data/models/EffectSchema.js";
-import EnvironmentComponentSchema from "./server/data/models/EnvironmentComponentSchema.js";
-import FunctionalBehaviorSchema from "./server/data/models/FunctionalBehaviorSchema.js";
-import GlossaryTermSchema from "./server/data/models/GlossaryTermSchema.js";
-import HintSchema from "./server/data/models/HintSchema.js";
-import InvariantSchema from "./server/data/models/InvariantSchema.js";
-import JustificationSchema from "./server/data/models/JustificationSchema.js";
-import LimitSchema from "./server/data/models/LimitSchema.js";
-import NonFunctionalBehaviorSchema from "./server/data/models/NonFunctionalBehaviorSchema.js";
-import ObstacleSchema from "./server/data/models/ObstacleSchema.js";
-import OutcomeSchema from "./server/data/models/OutcomeSchema.js";
-import PersonSchema from "./server/data/models/PersonSchema.js";
-import ProductSchema from "./server/data/models/ProductSchema.js";
-import SolutionSchema from "./server/data/models/SolutionSchema.js";
-import StakeholderSchema from "./server/data/models/StakeholderSchema.js";
-import UseCaseSchema from "./server/data/models/UseCaseSchema.js";
-import UserStorySchema from "./server/data/models/UserStorySchema.js";
-import SystemComponentSchema from "./server/data/models/SystemComponentSchema.js";
-import OrganizationSchema from "./server/data/models/OrganizationSchema.js";
-import AppUserOrganizationRoleSchema from "./server/data/models/AppUserOrganizationRoleSchema.js";
-import AppUserSchema from "./server/data/models/AppUserSchema.js";
+import AssumptionSchema from "./server/data/models/requirements/AssumptionSchema.js";
+import ConstraintSchema from "./server/data/models/requirements/ConstraintSchema.js";
+import EffectSchema from "./server/data/models/requirements/EffectSchema.js";
+import EnvironmentComponentSchema from "./server/data/models/requirements/EnvironmentComponentSchema.js";
+import FunctionalBehaviorSchema from "./server/data/models/requirements/FunctionalBehaviorSchema.js";
+import GlossaryTermSchema from "./server/data/models/requirements/GlossaryTermSchema.js";
+import HintSchema from "./server/data/models/requirements/HintSchema.js";
+import InvariantSchema from "./server/data/models/requirements/InvariantSchema.js";
+import JustificationSchema from "./server/data/models/requirements/JustificationSchema.js";
+import LimitSchema from "./server/data/models/requirements/LimitSchema.js";
+import NonFunctionalBehaviorSchema from "./server/data/models/requirements/NonFunctionalBehaviorSchema.js";
+import ObstacleSchema from "./server/data/models/requirements/ObstacleSchema.js";
+import OutcomeSchema from "./server/data/models/requirements/OutcomeSchema.js";
+import PersonSchema from "./server/data/models/requirements/PersonSchema.js";
+import ProductSchema from "./server/data/models/requirements/ProductSchema.js";
+import SolutionSchema from "./server/data/models/application/SolutionSchema.js";
+import StakeholderSchema from "./server/data/models/requirements/StakeholderSchema.js";
+import UseCaseSchema from "./server/data/models/requirements/UseCaseSchema.js";
+import UserStorySchema from "./server/data/models/requirements/UserStorySchema.js";
+import SystemComponentSchema from "./server/data/models/requirements/SystemComponentSchema.js";
+import OrganizationSchema from "./server/data/models/application/OrganizationSchema.js";
+import AppUserOrganizationRoleSchema from "./server/data/models/application/AppUserOrganizationRoleSchema.js";
+import AppUserSchema from "./server/data/models/application/AppUserSchema.js";
dotenv.config();
const config: Options = {
diff --git a/pages/o/[organization-slug]/[solution-slug]/environment/assumptions.client.vue b/pages/o/[organization-slug]/[solution-slug]/environment/assumptions.client.vue
index 27580cd2..d5f85cfc 100644
--- a/pages/o/[organization-slug]/[solution-slug]/environment/assumptions.client.vue
+++ b/pages/o/[organization-slug]/[solution-slug]/environment/assumptions.client.vue
@@ -73,9 +73,8 @@ const onUpdate = async (data: Assumption) => {
An example of an assumption would be: "Screen resolution will not change during
the execution of the program".
-
+
\ No newline at end of file
diff --git a/pages/o/[organization-slug]/[solution-slug]/environment/components.client.vue b/pages/o/[organization-slug]/[solution-slug]/environment/components.client.vue
index b68a10a0..4ed25cb1 100644
--- a/pages/o/[organization-slug]/[solution-slug]/environment/components.client.vue
+++ b/pages/o/[organization-slug]/[solution-slug]/environment/components.client.vue
@@ -66,8 +66,7 @@ const onUpdate = async (data: EnvironmentComponent) => {
Environment components are the EXTERNAL elements that the system interacts with.
These external components expose interfaces that the system uses to communicate with.
-
diff --git a/pages/o/[organization-slug]/[solution-slug]/goals/stakeholders.client.vue b/pages/o/[organization-slug]/[solution-slug]/goals/stakeholders.client.vue
index 781ef862..f4bc60a0 100644
--- a/pages/o/[organization-slug]/[solution-slug]/goals/stakeholders.client.vue
+++ b/pages/o/[organization-slug]/[solution-slug]/goals/stakeholders.client.vue
@@ -32,7 +32,7 @@ if (getStakeholdersError.value)
// watch the stakeholders and re-render the chart
watch(stakeholders, async () => {
- const groupStakeholders = Object.groupBy(stakeholders.value!, ({ segmentation }) => segmentation),
+ const groupStakeholders = Object.groupBy(stakeholders.value!, ({ segmentation }) => segmentation ?? 'unknown'),
clientGroup = groupStakeholders.Client ?? [],
vendorGroup = groupStakeholders.Vendor ?? [];
diff --git a/pages/o/[organization-slug]/[solution-slug]/project/roles-personnel.client.vue b/pages/o/[organization-slug]/[solution-slug]/project/roles-personnel.client.vue
index 64509bf8..748405eb 100644
--- a/pages/o/[organization-slug]/[solution-slug]/project/roles-personnel.client.vue
+++ b/pages/o/[organization-slug]/[solution-slug]/project/roles-personnel.client.vue
@@ -32,7 +32,8 @@ const onCreate = async (data: Person) => {
await $fetch(`/api/persons`, {
method: 'POST',
body: {
- ...data,
+ name: data.name ?? 'Anonymous',
+ email: data.email ?? 'anonymous@example.com',
solutionId,
statement: ''
}
@@ -45,7 +46,8 @@ const onUpdate = async (data: Person) => {
await $fetch(`/api/persons/${data.id}`, {
method: 'PUT',
body: {
- ...data,
+ name: data.name ?? 'Anonymous',
+ email: data.email ?? 'anonymous@example.com',
solutionId,
statement: ''
}
diff --git a/server/api/assumptions/[id].put.ts b/server/api/assumptions/[id].put.ts
index fed023f3..813b91e4 100644
--- a/server/api/assumptions/[id].put.ts
+++ b/server/api/assumptions/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Assumption}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/assumptions/index.post.ts b/server/api/assumptions/index.post.ts
index 76dcf01f..2ee453b7 100644
--- a/server/api/assumptions/index.post.ts
+++ b/server/api/assumptions/index.post.ts
@@ -4,8 +4,8 @@ import { Assumption } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Assumption}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/constraints/[id].put.ts b/server/api/constraints/[id].put.ts
index b55e3ff2..8ca47596 100644
--- a/server/api/constraints/[id].put.ts
+++ b/server/api/constraints/[id].put.ts
@@ -8,9 +8,9 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string(),
- category: z.nativeEnum(ConstraintCategory)
+ name: z.string().default("{Untitled Constraint}"),
+ statement: z.string().default(""),
+ category: z.nativeEnum(ConstraintCategory).optional()
})
/**
diff --git a/server/api/constraints/index.post.ts b/server/api/constraints/index.post.ts
index a637416c..1ecb745a 100644
--- a/server/api/constraints/index.post.ts
+++ b/server/api/constraints/index.post.ts
@@ -4,9 +4,9 @@ import { Constraint, ConstraintCategory } from "~/server/domain/requirements/ind
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string(),
- category: z.nativeEnum(ConstraintCategory)
+ name: z.string().default("{Untitled Constraint}"),
+ statement: z.string().default(""),
+ category: z.nativeEnum(ConstraintCategory).optional()
})
/**
diff --git a/server/api/effects/[id].put.ts b/server/api/effects/[id].put.ts
index e536d41a..c4af8388 100644
--- a/server/api/effects/[id].put.ts
+++ b/server/api/effects/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Effect}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/effects/index.post.ts b/server/api/effects/index.post.ts
index a8ee1a4f..014d99cd 100644
--- a/server/api/effects/index.post.ts
+++ b/server/api/effects/index.post.ts
@@ -4,8 +4,8 @@ import { Effect } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Effect}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/environment-components/[id].put.ts b/server/api/environment-components/[id].put.ts
index d58578c8..fe57f54a 100644
--- a/server/api/environment-components/[id].put.ts
+++ b/server/api/environment-components/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
+ name: z.string().default("{Untitled Environment Component}"),
+ statement: z.string().default(""),
parentComponentId: z.string().uuid().optional()
})
diff --git a/server/api/environment-components/index.post.ts b/server/api/environment-components/index.post.ts
index 02c19150..7cc7e69c 100644
--- a/server/api/environment-components/index.post.ts
+++ b/server/api/environment-components/index.post.ts
@@ -4,8 +4,8 @@ import { EnvironmentComponent } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
+ name: z.string().default("{Untitled Environment Component}"),
+ statement: z.string().default(""),
parentComponentId: z.string().uuid().optional()
})
diff --git a/server/api/functional-behaviors/[id].put.ts b/server/api/functional-behaviors/[id].put.ts
index 13bdf43a..c8a950eb 100644
--- a/server/api/functional-behaviors/[id].put.ts
+++ b/server/api/functional-behaviors/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string(),
+ name: z.string().default("{Untitled Functional Behavior}"),
+ statement: z.string().default(""),
priority: z.nativeEnum(MoscowPriority)
})
diff --git a/server/api/functional-behaviors/index.post.ts b/server/api/functional-behaviors/index.post.ts
index d3e1ff96..40f1fc3f 100644
--- a/server/api/functional-behaviors/index.post.ts
+++ b/server/api/functional-behaviors/index.post.ts
@@ -4,8 +4,8 @@ import { MoscowPriority, FunctionalBehavior } from "~/server/domain/requirements
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string(),
+ name: z.string().default("{Untitled Functional Behavior}"),
+ statement: z.string().default(""),
priority: z.nativeEnum(MoscowPriority)
})
diff --git a/server/api/glossary-terms/[id].put.ts b/server/api/glossary-terms/[id].put.ts
index cb68a53c..66dd41cc 100644
--- a/server/api/glossary-terms/[id].put.ts
+++ b/server/api/glossary-terms/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Glossary Term}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/glossary-terms/index.post.ts b/server/api/glossary-terms/index.post.ts
index b890f025..48a8760a 100644
--- a/server/api/glossary-terms/index.post.ts
+++ b/server/api/glossary-terms/index.post.ts
@@ -4,8 +4,8 @@ import { GlossaryTerm } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Glossary Term}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/invariants/[id].put.ts b/server/api/invariants/[id].put.ts
index 4bef46c7..40292d0b 100644
--- a/server/api/invariants/[id].put.ts
+++ b/server/api/invariants/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Invariant}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/invariants/index.post.ts b/server/api/invariants/index.post.ts
index dcb9a189..c94885eb 100644
--- a/server/api/invariants/index.post.ts
+++ b/server/api/invariants/index.post.ts
@@ -4,8 +4,8 @@ import { Invariant } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Invariant}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/justifications/[id].put.ts b/server/api/justifications/[id].put.ts
index 9f930e37..b28f4d6f 100644
--- a/server/api/justifications/[id].put.ts
+++ b/server/api/justifications/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Justification}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/justifications/index.post.ts b/server/api/justifications/index.post.ts
index bc37b0ea..8c455c3a 100644
--- a/server/api/justifications/index.post.ts
+++ b/server/api/justifications/index.post.ts
@@ -4,8 +4,8 @@ import { Justification } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Justification}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/limits/[id].put.ts b/server/api/limits/[id].put.ts
index 845b0bdb..629c293c 100644
--- a/server/api/limits/[id].put.ts
+++ b/server/api/limits/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string()
+ name: z.string().default("{Untitled Limit}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/limits/index.post.ts b/server/api/limits/index.post.ts
index c799528f..bf5faf95 100644
--- a/server/api/limits/index.post.ts
+++ b/server/api/limits/index.post.ts
@@ -4,8 +4,8 @@ import { Limit } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Limit}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/non-functional-behaviors/[id].put.ts b/server/api/non-functional-behaviors/[id].put.ts
index 85826c9e..47d35581 100644
--- a/server/api/non-functional-behaviors/[id].put.ts
+++ b/server/api/non-functional-behaviors/[id].put.ts
@@ -8,9 +8,9 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string(),
- priority: z.nativeEnum(MoscowPriority)
+ name: z.string().default("{Untitled Non-Functional Behavior}"),
+ statement: z.string().default(""),
+ priority: z.nativeEnum(MoscowPriority).optional()
})
/**
diff --git a/server/api/non-functional-behaviors/index.post.ts b/server/api/non-functional-behaviors/index.post.ts
index 514113d3..96555f6f 100644
--- a/server/api/non-functional-behaviors/index.post.ts
+++ b/server/api/non-functional-behaviors/index.post.ts
@@ -4,9 +4,9 @@ import { MoscowPriority, NonFunctionalBehavior } from "~/server/domain/requireme
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string(),
- priority: z.nativeEnum(MoscowPriority)
+ name: z.string().default("{Untitled Non-Functional Behavior}"),
+ statement: z.string().default(""),
+ priority: z.nativeEnum(MoscowPriority).optional()
})
/**
diff --git a/server/api/obstacles/[id].put.ts b/server/api/obstacles/[id].put.ts
index 6a26444c..0d772359 100644
--- a/server/api/obstacles/[id].put.ts
+++ b/server/api/obstacles/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string()
+ name: z.string().default("{Untitled Obstacle}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/obstacles/index.post.ts b/server/api/obstacles/index.post.ts
index 4a2a1633..2ac2f29e 100644
--- a/server/api/obstacles/index.post.ts
+++ b/server/api/obstacles/index.post.ts
@@ -4,8 +4,8 @@ import { Obstacle } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Obstacle}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/organizations/[id].put.ts b/server/api/organizations/[id].put.ts
index 90d4fa6e..e2e5ce98 100644
--- a/server/api/organizations/[id].put.ts
+++ b/server/api/organizations/[id].put.ts
@@ -7,8 +7,8 @@ const paramSchema = z.object({
})
const bodySchema = z.object({
- name: z.string().min(1),
- description: z.string()
+ name: z.string().default("{Untitled Organization}"),
+ description: z.string().default("")
})
/**
diff --git a/server/api/organizations/index.post.ts b/server/api/organizations/index.post.ts
index dd960ec1..1afa34ea 100644
--- a/server/api/organizations/index.post.ts
+++ b/server/api/organizations/index.post.ts
@@ -7,8 +7,8 @@ import { getServerSession } from '#auth'
import AppUser from "~/server/domain/application/AppUser"
const bodySchema = z.object({
- name: z.string().min(1),
- description: z.string()
+ name: z.string().default("{Untitled Organization}"),
+ description: z.string().default("")
})
/**
diff --git a/server/api/outcomes/[id].put.ts b/server/api/outcomes/[id].put.ts
index b347fad9..1a05afa5 100644
--- a/server/api/outcomes/[id].put.ts
+++ b/server/api/outcomes/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string()
+ name: z.string().default("{Untitled Outcome}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/outcomes/index.post.ts b/server/api/outcomes/index.post.ts
index 70cbb458..28cd139e 100644
--- a/server/api/outcomes/index.post.ts
+++ b/server/api/outcomes/index.post.ts
@@ -4,8 +4,8 @@ import { Outcome } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string().min(1),
- statement: z.string()
+ name: z.string().default("{Untitled Outcome}"),
+ statement: z.string().default("")
})
/**
diff --git a/server/api/persons/[id].put.ts b/server/api/persons/[id].put.ts
index 0ab5f92c..b0e4f8ea 100644
--- a/server/api/persons/[id].put.ts
+++ b/server/api/persons/[id].put.ts
@@ -8,9 +8,9 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
- email: z.string().email()
+ name: z.string().default("{Untitled Person}"),
+ statement: z.string().default(""),
+ email: z.string().email().optional()
})
/**
diff --git a/server/api/persons/index.post.ts b/server/api/persons/index.post.ts
index 31c2150c..eb534421 100644
--- a/server/api/persons/index.post.ts
+++ b/server/api/persons/index.post.ts
@@ -4,9 +4,9 @@ import { Person } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
- email: z.string().email()
+ name: z.string().default("{Anonymous Person}"),
+ statement: z.string().default(""),
+ email: z.string().email().optional()
})
/**
diff --git a/server/api/stakeholders/[id].put.ts b/server/api/stakeholders/[id].put.ts
index 3984a0b1..378a8ef2 100644
--- a/server/api/stakeholders/[id].put.ts
+++ b/server/api/stakeholders/[id].put.ts
@@ -8,13 +8,13 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
+ name: z.string().default("{Untitled Stakeholder}"),
+ statement: z.string().default(""),
parentComponentId: z.string().uuid().optional(),
- availability: z.number().min(0).max(100),
- influence: z.number().min(0).max(100),
- segmentation: z.nativeEnum(StakeholderSegmentation),
- category: z.nativeEnum(StakeholderCategory)
+ availability: z.number().min(0).max(100).default(50),
+ influence: z.number().min(0).max(100).default(50),
+ segmentation: z.nativeEnum(StakeholderSegmentation).optional(),
+ category: z.nativeEnum(StakeholderCategory).optional()
})
/**
diff --git a/server/api/stakeholders/index.post.ts b/server/api/stakeholders/index.post.ts
index 098c3cdd..c9dcaa20 100644
--- a/server/api/stakeholders/index.post.ts
+++ b/server/api/stakeholders/index.post.ts
@@ -4,13 +4,13 @@ import { Stakeholder, StakeholderCategory, StakeholderSegmentation } from "~/ser
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
+ name: z.string().default("{Untitled Stakeholder}"),
+ statement: z.string().default(""),
parentComponentId: z.string().uuid().optional(),
- availability: z.number().min(0).max(100),
- influence: z.number().min(0).max(100),
- segmentation: z.nativeEnum(StakeholderSegmentation),
- category: z.nativeEnum(StakeholderCategory)
+ availability: z.number().min(0).max(100).default(50),
+ influence: z.number().min(0).max(100).default(50),
+ segmentation: z.nativeEnum(StakeholderSegmentation).optional(),
+ category: z.nativeEnum(StakeholderCategory).optional()
})
/**
diff --git a/server/api/system-components/[id].put.ts b/server/api/system-components/[id].put.ts
index b79eb755..3c9de20c 100644
--- a/server/api/system-components/[id].put.ts
+++ b/server/api/system-components/[id].put.ts
@@ -8,8 +8,8 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
+ name: z.string().default("{Untitled Component}"),
+ statement: z.string().default(""),
parentComponentId: z.string().uuid().optional()
})
diff --git a/server/api/system-components/index.post.ts b/server/api/system-components/index.post.ts
index a5264bb5..67cd41ae 100644
--- a/server/api/system-components/index.post.ts
+++ b/server/api/system-components/index.post.ts
@@ -4,8 +4,8 @@ import { SystemComponent } from "~/server/domain/requirements/index.js"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
+ name: z.string().default("{Untitled System Component}"),
+ statement: z.string().default(""),
parentComponentId: z.string().uuid().optional()
})
diff --git a/server/api/use-cases/[id].put.ts b/server/api/use-cases/[id].put.ts
index 40d557b8..65e911a6 100644
--- a/server/api/use-cases/[id].put.ts
+++ b/server/api/use-cases/[id].put.ts
@@ -1,7 +1,6 @@
import { z } from "zod"
import { fork } from "~/server/data/orm"
import { Assumption, Effect, MoscowPriority, Stakeholder, UseCase } from "~/server/domain/requirements/index.js"
-import { NIL as emptyUuid } from "uuid"
const paramSchema = z.object({
id: z.string().uuid()
@@ -9,18 +8,18 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
- primaryActorId: z.string().uuid(),
- priority: z.nativeEnum(MoscowPriority),
- scope: z.string(),
- level: z.string(),
- goalInContext: z.string(),
- preconditionId: z.string().uuid(),
- triggerId: z.literal(emptyUuid),
- mainSuccessScenario: z.string(),
- successGuaranteeId: z.string().uuid(),
- extensions: z.string()
+ name: z.string().default("{Untitled Use Case}"),
+ statement: z.string().default(""),
+ primaryActorId: z.string().uuid().optional(),
+ priority: z.nativeEnum(MoscowPriority).optional(),
+ scope: z.string().default(""),
+ level: z.string().default(""),
+ goalInContext: z.string().default(""),
+ preconditionId: z.string().uuid().optional(),
+ triggerId: z.string().uuid().optional(),
+ mainSuccessScenario: z.string().default(""),
+ successGuaranteeId: z.string().uuid().optional(),
+ extensions: z.string().default("")
})
/**
@@ -33,42 +32,27 @@ export default defineEventHandler(async (event) => {
em = fork()
const useCase = await em.findOne(UseCase, id),
- primaryActor = await em.findOne(Stakeholder, body.primaryActorId),
- precondition = await em.findOne(Assumption, body.preconditionId),
- successGuarantee = await em.findOne(Effect, body.successGuaranteeId)
+ primaryActor = body.primaryActorId ? await em.findOne(Stakeholder, body.primaryActorId) : undefined,
+ precondition = body.preconditionId ? await em.findOne(Assumption, body.preconditionId) : undefined,
+ successGuarantee = body.successGuaranteeId ? await em.findOne(Effect, body.successGuaranteeId) : undefined
if (!useCase)
throw createError({
statusCode: 400,
statusMessage: `Bad Request: No use case found with id: ${id}`
})
- if (!primaryActor)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No primary actor found with id: ${body.primaryActorId}`
- })
- if (!precondition)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No precondition found with id: ${body.preconditionId}`
- })
- if (!successGuarantee)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No success guarantee found with id: ${body.successGuaranteeId}`
- })
useCase.name = body.name
useCase.statement = body.statement
- useCase.primaryActor = primaryActor
+ useCase.primaryActor = primaryActor ?? undefined
useCase.priority = body.priority
useCase.scope = body.scope
useCase.level = body.level
useCase.goalInContext = body.goalInContext
- useCase.precondition = precondition
+ useCase.precondition = precondition ?? undefined
useCase.triggerId = body.triggerId
useCase.mainSuccessScenario = body.mainSuccessScenario
- useCase.successGuarantee = successGuarantee
+ useCase.successGuarantee = successGuarantee ?? undefined
useCase.extensions = body.extensions
useCase.modifiedBy = sessionUser
diff --git a/server/api/use-cases/index.post.ts b/server/api/use-cases/index.post.ts
index c895d7f8..e1bd5a2d 100644
--- a/server/api/use-cases/index.post.ts
+++ b/server/api/use-cases/index.post.ts
@@ -27,39 +27,23 @@ export default defineEventHandler(async (event) => {
{ solution, sessionUser } = await assertSolutionContributor(event, body.solutionId),
em = fork()
- const primaryActor = await em.findOne(Stakeholder, body.primaryActorId),
- precondition = await em.findOne(Assumption, body.preconditionId),
- successGuarantee = await em.findOne(Effect, body.successGuaranteeId)
-
- if (!primaryActor)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No primary actor found with id: ${body.primaryActorId}`
- })
- if (!precondition)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No precondition found with id: ${body.preconditionId}`
- })
- if (!successGuarantee)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No success guarantee found with id: ${body.successGuaranteeId}`
- })
+ const primaryActor = body.primaryActorId ? await em.findOne(Stakeholder, body.primaryActorId) : undefined,
+ precondition = body.preconditionId ? await em.findOne(Assumption, body.preconditionId) : undefined,
+ successGuarantee = body.successGuaranteeId ? await em.findOne(Effect, body.successGuaranteeId) : undefined
const newUseCase = new UseCase({
name: body.name,
statement: body.statement,
solution,
- primaryActor,
+ primaryActor: primaryActor ?? undefined,
priority: body.priority,
scope: body.scope,
level: body.level,
goalInContext: body.goalInContext,
- precondition,
+ precondition: precondition ?? undefined,
triggerId: body.triggerId,
mainSuccessScenario: body.mainSuccessScenario,
- successGuarantee,
+ successGuarantee: successGuarantee ?? undefined,
extensions: body.extensions,
lastModified: new Date(),
modifiedBy: sessionUser
diff --git a/server/api/user-stories/[id].put.ts b/server/api/user-stories/[id].put.ts
index 77c4a66c..e9041ee9 100644
--- a/server/api/user-stories/[id].put.ts
+++ b/server/api/user-stories/[id].put.ts
@@ -8,12 +8,12 @@ const paramSchema = z.object({
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
- primaryActorId: z.string().uuid(),
- priority: z.nativeEnum(MoscowPriority),
- outcomeId: z.string().uuid(),
- functionalBehaviorId: z.string().uuid()
+ name: z.string().default("{Untitled User Story}"),
+ statement: z.string().default(""),
+ primaryActorId: z.string().uuid().optional(),
+ priority: z.nativeEnum(MoscowPriority).optional(),
+ outcomeId: z.string().uuid().optional(),
+ functionalBehaviorId: z.string().uuid().optional()
})
/**
@@ -26,37 +26,22 @@ export default defineEventHandler(async (event) => {
em = fork()
const userStory = await em.findOne(UserStory, id),
- primaryActor = await em.findOne(Stakeholder, body.primaryActorId),
- outcome = await em.findOne(Outcome, body.outcomeId),
- functionalBehavior = await em.findOne(FunctionalBehavior, body.functionalBehaviorId)
+ primaryActor = body.primaryActorId ? await em.findOne(Stakeholder, body.primaryActorId) : undefined,
+ outcome = body.outcomeId ? await em.findOne(Outcome, body.outcomeId) : undefined,
+ functionalBehavior = body.functionalBehaviorId ? await em.findOne(FunctionalBehavior, body.functionalBehaviorId) : undefined
if (!userStory)
throw createError({
statusCode: 400,
statusMessage: `Bad Request: No user story found with id: ${id}`
})
- if (!primaryActor)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No primary actor found with id: ${body.primaryActorId}`
- })
- if (!outcome)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No outcome found with id: ${body.outcomeId}`
- })
- if (!functionalBehavior)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No functional behavior found with id: ${body.functionalBehaviorId}`
- })
userStory.name = body.name
userStory.statement = body.statement
- userStory.primaryActor = primaryActor
+ userStory.primaryActor = primaryActor ?? undefined
userStory.priority = body.priority
- userStory.outcome = outcome
- userStory.functionalBehavior = functionalBehavior
+ userStory.outcome = outcome ?? undefined
+ userStory.functionalBehavior = functionalBehavior ?? undefined
userStory.modifiedBy = sessionUser
await em.flush()
diff --git a/server/api/user-stories/index.post.ts b/server/api/user-stories/index.post.ts
index 703ec1d6..a8b4021e 100644
--- a/server/api/user-stories/index.post.ts
+++ b/server/api/user-stories/index.post.ts
@@ -4,12 +4,12 @@ import { fork } from "~/server/data/orm"
const bodySchema = z.object({
solutionId: z.string().uuid(),
- name: z.string(),
- statement: z.string(),
- primaryActorId: z.string().uuid(),
- priority: z.nativeEnum(MoscowPriority),
- outcomeId: z.string().uuid(),
- functionalBehaviorId: z.string().uuid()
+ name: z.string().default("{Untitled User Story}"),
+ statement: z.string().default(""),
+ primaryActorId: z.string().uuid().optional(),
+ priority: z.nativeEnum(MoscowPriority).optional(),
+ outcomeId: z.string().uuid().optional(),
+ functionalBehaviorId: z.string().uuid().optional()
})
/**
@@ -21,34 +21,18 @@ export default defineEventHandler(async (event) => {
em = fork()
const [primaryActor, outcome, functionalBehavior] = await Promise.all([
- em.findOne(Stakeholder, body.primaryActorId),
- em.findOne(Outcome, body.outcomeId),
- em.findOne(FunctionalBehavior, body.functionalBehaviorId)
+ body.primaryActorId ? em.findOne(Stakeholder, body.primaryActorId) : undefined,
+ body.outcomeId ? em.findOne(Outcome, body.outcomeId) : undefined,
+ body.functionalBehaviorId ? em.findOne(FunctionalBehavior, body.functionalBehaviorId) : undefined
]);
- if (!primaryActor)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No primary actor found with id: ${body.primaryActorId}`
- })
- if (!outcome)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No outcome found with id: ${body.outcomeId}`
- })
- if (!functionalBehavior)
- throw createError({
- statusCode: 400,
- statusMessage: `Bad Request: No functional behavior found with id: ${body.functionalBehaviorId}`
- })
-
const newUserStory = new UserStory({
- functionalBehavior,
- outcome,
+ functionalBehavior: functionalBehavior ?? undefined,
+ outcome: outcome ?? undefined,
name: body.name,
statement: body.statement,
solution,
- primaryActor,
+ primaryActor: primaryActor ?? undefined,
priority: body.priority,
lastModified: new Date(),
modifiedBy: sessionUser
diff --git a/server/data/models/AppUserOrganizationRoleSchema.ts b/server/data/models/application/AppUserOrganizationRoleSchema.ts
similarity index 71%
rename from server/data/models/AppUserOrganizationRoleSchema.ts
rename to server/data/models/application/AppUserOrganizationRoleSchema.ts
index a220c324..ab14bef6 100644
--- a/server/data/models/AppUserOrganizationRoleSchema.ts
+++ b/server/data/models/application/AppUserOrganizationRoleSchema.ts
@@ -1,6 +1,6 @@
-import { Cascade, EntitySchema } from "@mikro-orm/core";
-import AppUserOrganizationRole from "../../domain/application/AppUserOrganizationRole.js";
-import AppRole from "../../domain/application/AppRole.js";
+import { EntitySchema } from "@mikro-orm/core";
+import AppUserOrganizationRole from "../../../domain/application/AppUserOrganizationRole.js";
+import AppRole from "../../../domain/application/AppRole.js";
export default new EntitySchema({
class: AppUserOrganizationRole,
diff --git a/server/data/models/AppUserSchema.ts b/server/data/models/application/AppUserSchema.ts
similarity index 91%
rename from server/data/models/AppUserSchema.ts
rename to server/data/models/application/AppUserSchema.ts
index 7bf1a404..ef9602c9 100644
--- a/server/data/models/AppUserSchema.ts
+++ b/server/data/models/application/AppUserSchema.ts
@@ -1,5 +1,5 @@
import { EntitySchema } from "@mikro-orm/core";
-import AppUser from "../../domain/application/AppUser.js";
+import AppUser from "../../../domain/application/AppUser.js";
export default new EntitySchema({
class: AppUser,
diff --git a/server/data/models/OrganizationSchema.ts b/server/data/models/application/OrganizationSchema.ts
similarity index 86%
rename from server/data/models/OrganizationSchema.ts
rename to server/data/models/application/OrganizationSchema.ts
index 99309681..04273b7a 100644
--- a/server/data/models/OrganizationSchema.ts
+++ b/server/data/models/application/OrganizationSchema.ts
@@ -1,5 +1,5 @@
import { EntitySchema } from "@mikro-orm/core";
-import Organization from "../../domain/application/Organization.js";
+import Organization from "../../../domain/application/Organization.js";
export default new EntitySchema({
class: Organization,
diff --git a/server/data/models/SolutionSchema.ts b/server/data/models/application/SolutionSchema.ts
similarity index 93%
rename from server/data/models/SolutionSchema.ts
rename to server/data/models/application/SolutionSchema.ts
index ea91c02d..473df944 100644
--- a/server/data/models/SolutionSchema.ts
+++ b/server/data/models/application/SolutionSchema.ts
@@ -1,11 +1,11 @@
import { EntitySchema } from "@mikro-orm/core";
-import Solution from "../../domain/application/Solution.js";
-import Organization from "../../domain/application/Organization.js";
+import Solution from "../../../domain/application/Solution.js";
+import Organization from "../../../domain/application/Organization.js";
import {
Assumption, Constraint, Effect, EnvironmentComponent, FunctionalBehavior,
GlossaryTerm, Invariant, Justification, Limit, NonFunctionalBehavior, Obstacle,
Outcome, Person, Stakeholder, SystemComponent, UseCase, UserStory
-} from "../../domain/requirements/index.js";
+} from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Solution,
diff --git a/server/data/models/AssumptionSchema.ts b/server/data/models/requirements/AssumptionSchema.ts
similarity index 73%
rename from server/data/models/AssumptionSchema.ts
rename to server/data/models/requirements/AssumptionSchema.ts
index e4b2f05f..d512bced 100644
--- a/server/data/models/AssumptionSchema.ts
+++ b/server/data/models/requirements/AssumptionSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Assumption, Requirement } from "../../domain/requirements/index.js";
+import { Assumption, Requirement } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Assumption,
diff --git a/server/data/models/BehaviorSchema.ts b/server/data/models/requirements/BehaviorSchema.ts
similarity index 60%
rename from server/data/models/BehaviorSchema.ts
rename to server/data/models/requirements/BehaviorSchema.ts
index f67d2df2..8008a329 100644
--- a/server/data/models/BehaviorSchema.ts
+++ b/server/data/models/requirements/BehaviorSchema.ts
@@ -1,12 +1,12 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Behavior, MoscowPriority, Requirement } from "../../domain/requirements/index.js";
+import { Behavior, MoscowPriority, Requirement } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Behavior,
extends: RequirementSchema,
abstract: true,
properties: {
- priority: { enum: true, items: () => MoscowPriority }
+ priority: { enum: true, items: () => MoscowPriority, nullable: true }
}
})
\ No newline at end of file
diff --git a/server/data/models/ConstraintSchema.ts b/server/data/models/requirements/ConstraintSchema.ts
similarity index 87%
rename from server/data/models/ConstraintSchema.ts
rename to server/data/models/requirements/ConstraintSchema.ts
index a7f8e162..18410c1a 100644
--- a/server/data/models/ConstraintSchema.ts
+++ b/server/data/models/requirements/ConstraintSchema.ts
@@ -1,11 +1,11 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Requirement, Constraint, ConstraintCategory } from "../../domain/requirements/index.js";
+import { Requirement, Constraint, ConstraintCategory } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Constraint,
extends: RequirementSchema,
properties: {
- category: { enum: true, items: () => ConstraintCategory, nullable: false }
+ category: { enum: true, items: () => ConstraintCategory, nullable: true }
}
})
\ No newline at end of file
diff --git a/server/data/models/EffectSchema.ts b/server/data/models/requirements/EffectSchema.ts
similarity index 73%
rename from server/data/models/EffectSchema.ts
rename to server/data/models/requirements/EffectSchema.ts
index 47594039..d6a10fe9 100644
--- a/server/data/models/EffectSchema.ts
+++ b/server/data/models/requirements/EffectSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Requirement, Effect } from "../../domain/requirements/index.js";
+import { Requirement, Effect } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Effect,
diff --git a/server/data/models/EnvironmentComponentSchema.ts b/server/data/models/requirements/EnvironmentComponentSchema.ts
similarity index 79%
rename from server/data/models/EnvironmentComponentSchema.ts
rename to server/data/models/requirements/EnvironmentComponentSchema.ts
index 429b3a93..eecf05bf 100644
--- a/server/data/models/EnvironmentComponentSchema.ts
+++ b/server/data/models/requirements/EnvironmentComponentSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Component, EnvironmentComponent } from "../../domain/requirements/index.js";
+import { Component, EnvironmentComponent } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: EnvironmentComponent,
diff --git a/server/data/models/FunctionalBehaviorSchema.ts b/server/data/models/requirements/FunctionalBehaviorSchema.ts
similarity index 73%
rename from server/data/models/FunctionalBehaviorSchema.ts
rename to server/data/models/requirements/FunctionalBehaviorSchema.ts
index adc93dc2..2a2ef8e2 100644
--- a/server/data/models/FunctionalBehaviorSchema.ts
+++ b/server/data/models/requirements/FunctionalBehaviorSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import BehaviorSchema from "./BehaviorSchema.js";
-import { FunctionalBehavior, Functionality } from "../../domain/requirements/index.js";
+import { FunctionalBehavior, Functionality } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: FunctionalBehavior,
diff --git a/server/data/models/GlossaryTermSchema.ts b/server/data/models/requirements/GlossaryTermSchema.ts
similarity index 80%
rename from server/data/models/GlossaryTermSchema.ts
rename to server/data/models/requirements/GlossaryTermSchema.ts
index 14ac79c0..b3949cc1 100644
--- a/server/data/models/GlossaryTermSchema.ts
+++ b/server/data/models/requirements/GlossaryTermSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Component, GlossaryTerm } from "../../domain/requirements/index.js";
+import { Component, GlossaryTerm } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: GlossaryTerm,
diff --git a/server/data/models/HintSchema.ts b/server/data/models/requirements/HintSchema.ts
similarity index 74%
rename from server/data/models/HintSchema.ts
rename to server/data/models/requirements/HintSchema.ts
index 0b958d18..62a67711 100644
--- a/server/data/models/HintSchema.ts
+++ b/server/data/models/requirements/HintSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Hint, Noise } from "../../domain/requirements/index.js";
+import { Hint, Noise } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Hint,
diff --git a/server/data/models/InvariantSchema.ts b/server/data/models/requirements/InvariantSchema.ts
similarity index 73%
rename from server/data/models/InvariantSchema.ts
rename to server/data/models/requirements/InvariantSchema.ts
index c9bbb620..461b6c10 100644
--- a/server/data/models/InvariantSchema.ts
+++ b/server/data/models/requirements/InvariantSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Requirement, Invariant } from "../../domain/requirements/index.js";
+import { Requirement, Invariant } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Invariant,
diff --git a/server/data/models/JustificationSchema.ts b/server/data/models/requirements/JustificationSchema.ts
similarity index 72%
rename from server/data/models/JustificationSchema.ts
rename to server/data/models/requirements/JustificationSchema.ts
index 39e622e8..75452513 100644
--- a/server/data/models/JustificationSchema.ts
+++ b/server/data/models/requirements/JustificationSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Justification, MetaRequirement } from "../../domain/requirements/index.js";
+import { Justification, MetaRequirement } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Justification,
diff --git a/server/data/models/LimitSchema.ts b/server/data/models/requirements/LimitSchema.ts
similarity index 73%
rename from server/data/models/LimitSchema.ts
rename to server/data/models/requirements/LimitSchema.ts
index f9abe7a5..c3a51261 100644
--- a/server/data/models/LimitSchema.ts
+++ b/server/data/models/requirements/LimitSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Requirement, Limit } from "../../domain/requirements/index.js";
+import { Requirement, Limit } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Limit,
diff --git a/server/data/models/NonFunctionalBehaviorSchema.ts b/server/data/models/requirements/NonFunctionalBehaviorSchema.ts
similarity index 73%
rename from server/data/models/NonFunctionalBehaviorSchema.ts
rename to server/data/models/requirements/NonFunctionalBehaviorSchema.ts
index e32fcd64..1fbfdd67 100644
--- a/server/data/models/NonFunctionalBehaviorSchema.ts
+++ b/server/data/models/requirements/NonFunctionalBehaviorSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import BehaviorSchema from "./BehaviorSchema.js";
-import { Functionality, NonFunctionalBehavior } from "../../domain/requirements/index.js";
+import { Functionality, NonFunctionalBehavior } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: NonFunctionalBehavior,
diff --git a/server/data/models/ObstacleSchema.ts b/server/data/models/requirements/ObstacleSchema.ts
similarity index 74%
rename from server/data/models/ObstacleSchema.ts
rename to server/data/models/requirements/ObstacleSchema.ts
index 0501cea1..3f3f5b7e 100644
--- a/server/data/models/ObstacleSchema.ts
+++ b/server/data/models/requirements/ObstacleSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Obstacle, Goal } from "../../domain/requirements/index.js";
+import { Obstacle, Goal } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Obstacle,
diff --git a/server/data/models/OutcomeSchema.ts b/server/data/models/requirements/OutcomeSchema.ts
similarity index 74%
rename from server/data/models/OutcomeSchema.ts
rename to server/data/models/requirements/OutcomeSchema.ts
index 27759f01..732a6b3d 100644
--- a/server/data/models/OutcomeSchema.ts
+++ b/server/data/models/requirements/OutcomeSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Goal, Outcome } from "../../domain/requirements/index.js";
+import { Goal, Outcome } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Outcome,
diff --git a/server/data/models/PersonSchema.ts b/server/data/models/requirements/PersonSchema.ts
similarity index 65%
rename from server/data/models/PersonSchema.ts
rename to server/data/models/requirements/PersonSchema.ts
index 4f215f23..7103415a 100644
--- a/server/data/models/PersonSchema.ts
+++ b/server/data/models/requirements/PersonSchema.ts
@@ -1,11 +1,11 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Actor, Person } from "../../domain/requirements/index.js";
+import { Actor, Person } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Person,
extends: RequirementSchema,
properties: {
- email: { type: 'string', nullable: false }
+ email: { type: 'string', nullable: true }
}
})
\ No newline at end of file
diff --git a/server/data/models/ProductSchema.ts b/server/data/models/requirements/ProductSchema.ts
similarity index 73%
rename from server/data/models/ProductSchema.ts
rename to server/data/models/requirements/ProductSchema.ts
index f2c9cea8..3adfae94 100644
--- a/server/data/models/ProductSchema.ts
+++ b/server/data/models/requirements/ProductSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Requirement, Product } from "../../domain/requirements/index.js";
+import { Requirement, Product } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Product,
diff --git a/server/data/models/RequirementSchema.ts b/server/data/models/requirements/RequirementSchema.ts
similarity index 92%
rename from server/data/models/RequirementSchema.ts
rename to server/data/models/requirements/RequirementSchema.ts
index 96236745..5fafe29d 100644
--- a/server/data/models/RequirementSchema.ts
+++ b/server/data/models/requirements/RequirementSchema.ts
@@ -1,5 +1,5 @@
import { EntitySchema } from "@mikro-orm/core";
-import { Requirement } from "../../domain/requirements/index.js";
+import { Requirement } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Requirement,
diff --git a/server/data/models/ScenarioSchema.ts b/server/data/models/requirements/ScenarioSchema.ts
similarity index 78%
rename from server/data/models/ScenarioSchema.ts
rename to server/data/models/requirements/ScenarioSchema.ts
index d347960d..43b0f231 100644
--- a/server/data/models/ScenarioSchema.ts
+++ b/server/data/models/requirements/ScenarioSchema.ts
@@ -1,12 +1,12 @@
import { EntitySchema } from "@mikro-orm/core";
import BehaviorSchema from "./BehaviorSchema.js";
-import { Example, Scenario } from "../../domain/requirements/index.js";
+import { Example, Scenario } from "../../../domain/requirements/index.js";
export default new EntitySchema({
abstract: true,
class: Scenario,
extends: BehaviorSchema,
properties: {
- primaryActor: { kind: 'm:1', entity: 'Stakeholder', nullable: false }
+ primaryActor: { kind: 'm:1', entity: 'Stakeholder', nullable: true }
}
})
\ No newline at end of file
diff --git a/server/data/models/StakeholderSchema.ts b/server/data/models/requirements/StakeholderSchema.ts
similarity index 88%
rename from server/data/models/StakeholderSchema.ts
rename to server/data/models/requirements/StakeholderSchema.ts
index 5c5fb580..d42b0a2f 100644
--- a/server/data/models/StakeholderSchema.ts
+++ b/server/data/models/requirements/StakeholderSchema.ts
@@ -2,7 +2,7 @@ import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
import {
Component, Stakeholder, StakeholderSegmentation, StakeholderCategory
-} from "../../domain/requirements/index.js";
+} from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: Stakeholder,
@@ -10,8 +10,8 @@ export default new EntitySchema({
properties: {
influence: { type: 'number', nullable: false, check: 'influence >= 0 AND influence <= 100' },
availability: { type: 'number', nullable: false, check: 'availability >= 0 AND availability <= 100' },
- segmentation: { enum: true, items: () => StakeholderSegmentation, nullable: false },
- category: { enum: true, items: () => StakeholderCategory, nullable: false },
+ segmentation: { enum: true, items: () => StakeholderSegmentation, nullable: true },
+ category: { enum: true, items: () => StakeholderCategory, nullable: true },
parentComponent: { kind: 'm:1', entity: 'Stakeholder', nullable: true }
}
})
\ No newline at end of file
diff --git a/server/data/models/SystemComponentSchema.ts b/server/data/models/requirements/SystemComponentSchema.ts
similarity index 80%
rename from server/data/models/SystemComponentSchema.ts
rename to server/data/models/requirements/SystemComponentSchema.ts
index fabe4cae..a2f82949 100644
--- a/server/data/models/SystemComponentSchema.ts
+++ b/server/data/models/requirements/SystemComponentSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import RequirementSchema from "./RequirementSchema.js";
-import { Component, SystemComponent } from "../../domain/requirements/index.js";
+import { Component, SystemComponent } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: SystemComponent,
diff --git a/server/data/models/UseCaseSchema.ts b/server/data/models/requirements/UseCaseSchema.ts
similarity index 80%
rename from server/data/models/UseCaseSchema.ts
rename to server/data/models/requirements/UseCaseSchema.ts
index d55fe459..5c8b1794 100644
--- a/server/data/models/UseCaseSchema.ts
+++ b/server/data/models/requirements/UseCaseSchema.ts
@@ -1,6 +1,6 @@
import { EntitySchema } from "@mikro-orm/core";
import ScenarioSchema from "./ScenarioSchema.js";
-import { Scenario, UseCase } from "../../domain/requirements/index.js";
+import { Scenario, UseCase } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: UseCase,
@@ -9,10 +9,10 @@ export default new EntitySchema({
scope: { type: 'string', nullable: false },
level: { type: 'string', nullable: false },
goalInContext: { type: 'string', nullable: false },
- precondition: { kind: 'm:1', entity: 'Assumption', nullable: false },
- triggerId: { type: 'uuid', nullable: false },
+ precondition: { kind: 'm:1', entity: 'Assumption', nullable: true },
+ triggerId: { type: 'uuid', nullable: true },
mainSuccessScenario: { type: 'string', nullable: false },
- successGuarantee: { kind: 'm:1', entity: 'Effect', nullable: false },
+ successGuarantee: { kind: 'm:1', entity: 'Effect', nullable: true },
extensions: { type: 'string', nullable: false },
}
})
\ No newline at end of file
diff --git a/server/data/models/UserStorySchema.ts b/server/data/models/requirements/UserStorySchema.ts
similarity index 63%
rename from server/data/models/UserStorySchema.ts
rename to server/data/models/requirements/UserStorySchema.ts
index b8790bf8..76555be4 100644
--- a/server/data/models/UserStorySchema.ts
+++ b/server/data/models/requirements/UserStorySchema.ts
@@ -1,12 +1,12 @@
import { EntitySchema } from "@mikro-orm/core";
import ScenarioSchema from "./ScenarioSchema.js";
-import { Scenario, UserStory } from "../../domain/requirements/index.js";
+import { Scenario, UserStory } from "../../../domain/requirements/index.js";
export default new EntitySchema({
class: UserStory,
extends: ScenarioSchema,
properties: {
- functionalBehavior: { kind: 'm:1', entity: 'FunctionalBehavior', nullable: false },
- outcome: { kind: 'm:1', entity: 'Outcome', nullable: false }
+ functionalBehavior: { kind: 'm:1', entity: 'FunctionalBehavior', nullable: true },
+ outcome: { kind: 'm:1', entity: 'Outcome', nullable: true }
}
})
\ No newline at end of file
diff --git a/server/domain/requirements/Behavior.ts b/server/domain/requirements/Behavior.ts
index bea6b5f6..964e222a 100644
--- a/server/domain/requirements/Behavior.ts
+++ b/server/domain/requirements/Behavior.ts
@@ -13,5 +13,5 @@ export abstract class Behavior extends Requirement {
/**
* The priority of the behavior.
*/
- priority: MoscowPriority;
+ priority?: MoscowPriority;
}
diff --git a/server/domain/requirements/Constraint.ts b/server/domain/requirements/Constraint.ts
index 52208423..ff1ab1bd 100644
--- a/server/domain/requirements/Constraint.ts
+++ b/server/domain/requirements/Constraint.ts
@@ -13,5 +13,5 @@ export class Constraint extends Requirement {
/**
* Category of the constraint
*/
- category: ConstraintCategory;
+ category?: ConstraintCategory;
}
diff --git a/server/domain/requirements/Person.ts b/server/domain/requirements/Person.ts
index a9840b0e..c27a2555 100644
--- a/server/domain/requirements/Person.ts
+++ b/server/domain/requirements/Person.ts
@@ -13,5 +13,5 @@ export class Person extends Actor {
/**
* Email address of the person
*/
- email: string;
+ email?: string;
}
diff --git a/server/domain/requirements/Scenario.ts b/server/domain/requirements/Scenario.ts
index c06145f4..f2a2e161 100644
--- a/server/domain/requirements/Scenario.ts
+++ b/server/domain/requirements/Scenario.ts
@@ -14,5 +14,5 @@ export abstract class Scenario extends Example {
/**
* Primary actor involved in the scenario
*/
- primaryActor: Stakeholder;
+ primaryActor?: Stakeholder;
}
diff --git a/server/domain/requirements/Stakeholder.ts b/server/domain/requirements/Stakeholder.ts
index 1dbd34e4..8fa4f553 100644
--- a/server/domain/requirements/Stakeholder.ts
+++ b/server/domain/requirements/Stakeholder.ts
@@ -23,12 +23,12 @@ export class Stakeholder extends Component {
/**
* The segmentation of the stakeholder.
*/
- segmentation: StakeholderSegmentation;
+ segmentation?: StakeholderSegmentation;
/**
* The category of the stakeholder.
*/
- category: StakeholderCategory;
+ category?: StakeholderCategory;
/**
* The availability of the stakeholder.
diff --git a/server/domain/requirements/UseCase.ts b/server/domain/requirements/UseCase.ts
index d5c74cb8..064712e8 100644
--- a/server/domain/requirements/UseCase.ts
+++ b/server/domain/requirements/UseCase.ts
@@ -41,12 +41,12 @@ export class UseCase extends Scenario {
/**
* The precondition is an Assumption that must be true before the use case can start.
*/
- precondition: Assumption;
+ precondition?: Assumption;
/**
* The action upon the system that starts the use case.
*/
- triggerId: string = emptyUuid;
+ triggerId?: string;
/**
* The main success scenario is the most common path through the system.
@@ -62,7 +62,7 @@ export class UseCase extends Scenario {
/**
* An Effect that is guaranteed to be true after the use case is completed.
*/
- successGuarantee: Effect;
+ successGuarantee?: Effect;
/**
* Extensions of the use case.
diff --git a/server/domain/requirements/UserStory.ts b/server/domain/requirements/UserStory.ts
index 0fc37fcf..ead2f8df 100644
--- a/server/domain/requirements/UserStory.ts
+++ b/server/domain/requirements/UserStory.ts
@@ -20,10 +20,10 @@ export class UserStory extends Scenario {
/**
* The action that the user wants to perform.
*/
- functionalBehavior: FunctionalBehavior;
+ functionalBehavior?: FunctionalBehavior;
/**
* The outcome that the story is aiming to achieve.
*/
- outcome: Outcome;
+ outcome?: Outcome;
}