Skip to content

Commit 773933a

Browse files
Merge pull request #2213 from bluewave-labs/mo-228-sept-24-p2-fe-class-based-models
Mo 228 sept 24 Part 2 FE class based models
2 parents 08757cb + ba1af93 commit 773933a

File tree

17 files changed

+551
-0
lines changed

17 files changed

+551
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export class ProjectFrameworksModel {
2+
framework_id!: number;
3+
project_id!: number;
4+
is_demo?: boolean;
5+
6+
constructor(data: ProjectFrameworksModel) {
7+
this.framework_id = data.framework_id;
8+
this.project_id = data.project_id;
9+
this.is_demo = data.is_demo;
10+
}
11+
12+
static createNewProjectFrameworks(
13+
data: ProjectFrameworksModel
14+
): ProjectFrameworksModel {
15+
return new ProjectFrameworksModel(data);
16+
}
17+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export class ProjectScopeModel {
2+
id?: number;
3+
assessmentId!: number;
4+
describeAiEnvironment!: string;
5+
isNewAiTechnology!: boolean;
6+
usesPersonalData!: boolean;
7+
projectScopeDocuments!: string;
8+
technologyType!: string;
9+
hasOngoingMonitoring!: boolean;
10+
unintendedOutcomes!: string;
11+
technologyDocumentation!: string;
12+
is_demo?: boolean;
13+
created_at?: Date;
14+
15+
constructor(data: ProjectScopeModel) {
16+
this.id = data.id;
17+
this.assessmentId = data.assessmentId;
18+
this.describeAiEnvironment = data.describeAiEnvironment;
19+
this.isNewAiTechnology = data.isNewAiTechnology;
20+
this.usesPersonalData = data.usesPersonalData;
21+
this.projectScopeDocuments = data.projectScopeDocuments;
22+
this.technologyType = data.technologyType;
23+
this.hasOngoingMonitoring = data.hasOngoingMonitoring;
24+
this.unintendedOutcomes = data.unintendedOutcomes;
25+
this.technologyDocumentation = data.technologyDocumentation;
26+
this.is_demo = data.is_demo;
27+
this.created_at = data.created_at;
28+
}
29+
30+
static createNewProjectScope(data: ProjectScopeModel): ProjectScopeModel {
31+
return new ProjectScopeModel(data);
32+
}
33+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export class ProjectsMembersModel {
2+
user_id!: number;
3+
project_id!: number;
4+
is_demo?: boolean;
5+
6+
constructor(data: ProjectsMembersModel) {
7+
this.user_id = data.user_id;
8+
this.project_id = data.project_id;
9+
this.is_demo = data.is_demo;
10+
}
11+
12+
static createNewProjectsMembers(
13+
data: ProjectsMembersModel
14+
): ProjectsMembersModel {
15+
return new ProjectsMembersModel(data);
16+
}
17+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
export class QuestionModel {
2+
id?: number;
3+
order_no?: number;
4+
question!: string;
5+
hint!: string;
6+
priority_level!: "high priority" | "medium priority" | "low priority";
7+
answer_type!: string;
8+
input_type!: string;
9+
evidence_required!: boolean;
10+
is_required!: boolean;
11+
dropdown_options?: any[];
12+
evidence_files?: {
13+
id: string;
14+
fileName: string;
15+
project_id: number;
16+
uploaded_by: number;
17+
uploaded_time: Date;
18+
}[];
19+
answer?: string;
20+
subtopic_id!: number;
21+
is_demo?: boolean;
22+
created_at?: Date;
23+
status?: "Not started" | "In progress" | "Done";
24+
25+
constructor(data: QuestionModel) {
26+
this.id = data.id;
27+
this.order_no = data.order_no;
28+
this.question = data.question;
29+
this.hint = data.hint;
30+
this.priority_level = data.priority_level;
31+
this.answer_type = data.answer_type;
32+
this.input_type = data.input_type;
33+
this.evidence_required = data.evidence_required;
34+
this.is_required = data.is_required;
35+
this.dropdown_options = data.dropdown_options;
36+
this.evidence_files = data.evidence_files;
37+
this.answer = data.answer;
38+
this.subtopic_id = data.subtopic_id;
39+
this.is_demo = data.is_demo;
40+
this.created_at = data.created_at;
41+
this.status = data.status;
42+
}
43+
44+
static createNewQuestion(data: QuestionModel): QuestionModel {
45+
return new QuestionModel(data);
46+
}
47+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
export class RiskModel {
2+
id?: number;
3+
risk_name!: string;
4+
risk_owner!: number;
5+
ai_lifecycle_phase!:
6+
| "Problem definition & planning"
7+
| "Data collection & processing"
8+
| "Model development & training"
9+
| "Model validation & testing"
10+
| "Deployment & integration"
11+
| "Monitoring & maintenance"
12+
| "Decommissioning & retirement";
13+
risk_description!: string;
14+
risk_category!: string[];
15+
impact!: string;
16+
assessment_mapping!: string;
17+
controls_mapping!: string;
18+
likelihood!: "Rare" | "Unlikely" | "Possible" | "Likely" | "Almost Certain";
19+
severity!: "Negligible" | "Minor" | "Moderate" | "Major" | "Catastrophic";
20+
risk_level_autocalculated!:
21+
| "No risk"
22+
| "Very low risk"
23+
| "Low risk"
24+
| "Medium risk"
25+
| "High risk"
26+
| "Very high risk";
27+
review_notes!: string;
28+
mitigation_status!:
29+
| "Not Started"
30+
| "In Progress"
31+
| "Completed"
32+
| "On Hold"
33+
| "Deferred"
34+
| "Canceled"
35+
| "Requires review";
36+
current_risk_level!:
37+
| "Very Low risk"
38+
| "Low risk"
39+
| "Medium risk"
40+
| "High risk"
41+
| "Very high risk";
42+
deadline!: Date;
43+
mitigation_plan!: string;
44+
implementation_strategy!: string;
45+
mitigation_evidence_document!: string;
46+
likelihood_mitigation!:
47+
| "Rare"
48+
| "Unlikely"
49+
| "Possible"
50+
| "Likely"
51+
| "Almost Certain";
52+
risk_severity!: "Negligible" | "Minor" | "Moderate" | "Major" | "Critical";
53+
final_risk_level!: string;
54+
risk_approval!: number;
55+
approval_status!: string;
56+
date_of_assessment!: Date;
57+
is_demo?: boolean;
58+
created_at?: Date;
59+
60+
constructor(data: RiskModel) {
61+
this.id = data.id;
62+
this.risk_name = data.risk_name;
63+
this.risk_owner = data.risk_owner;
64+
this.ai_lifecycle_phase = data.ai_lifecycle_phase;
65+
this.risk_description = data.risk_description;
66+
this.risk_category = data.risk_category;
67+
this.impact = data.impact;
68+
this.assessment_mapping = data.assessment_mapping;
69+
this.controls_mapping = data.controls_mapping;
70+
this.likelihood = data.likelihood;
71+
this.severity = data.severity;
72+
this.risk_level_autocalculated = data.risk_level_autocalculated;
73+
this.review_notes = data.review_notes;
74+
this.mitigation_status = data.mitigation_status;
75+
this.current_risk_level = data.current_risk_level;
76+
this.deadline = data.deadline;
77+
this.mitigation_plan = data.mitigation_plan;
78+
this.implementation_strategy = data.implementation_strategy;
79+
this.mitigation_evidence_document = data.mitigation_evidence_document;
80+
this.likelihood_mitigation = data.likelihood_mitigation;
81+
this.risk_severity = data.risk_severity;
82+
this.final_risk_level = data.final_risk_level;
83+
this.risk_approval = data.risk_approval;
84+
this.approval_status = data.approval_status;
85+
this.date_of_assessment = data.date_of_assessment;
86+
this.is_demo = data.is_demo;
87+
this.created_at = data.created_at;
88+
}
89+
90+
static createNewRisk(data: RiskModel): RiskModel {
91+
return new RiskModel(data);
92+
}
93+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export class RoleModel {
2+
id?: number;
3+
name!: string;
4+
description!: string;
5+
is_demo?: boolean;
6+
created_at?: Date;
7+
8+
constructor(data: RoleModel) {
9+
this.id = data.id;
10+
this.name = data.name;
11+
this.description = data.description;
12+
this.is_demo = data.is_demo;
13+
this.created_at = data.created_at;
14+
}
15+
16+
static createRole(data: RoleModel): RoleModel {
17+
return new RoleModel(data);
18+
}
19+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
export class SubControlModel {
2+
id?: number;
3+
title!: string;
4+
description!: string;
5+
order_no?: number;
6+
status?: "Waiting" | "In progress" | "Done";
7+
approver?: number;
8+
risk_review?: "Acceptable risk" | "Residual risk" | "Unacceptable risk";
9+
owner?: number;
10+
reviewer?: number;
11+
due_date?: Date;
12+
implementation_details?: string;
13+
evidence_description?: string;
14+
feedback_description?: string;
15+
evidence_files?: {
16+
id: string;
17+
fileName: string;
18+
project_id: number;
19+
uploaded_by: number;
20+
uploaded_time: Date;
21+
}[];
22+
feedback_files?: {
23+
id: string;
24+
fileName: string;
25+
project_id: number;
26+
uploaded_by: number;
27+
uploaded_time: Date;
28+
}[];
29+
control_id!: number;
30+
is_demo?: boolean;
31+
created_at?: Date;
32+
33+
constructor(data: SubControlModel) {
34+
this.id = data.id;
35+
this.title = data.title;
36+
this.description = data.description;
37+
this.order_no = data.order_no;
38+
this.status = data.status;
39+
this.approver = data.approver;
40+
this.risk_review = data.risk_review;
41+
this.owner = data.owner;
42+
this.reviewer = data.reviewer;
43+
this.due_date = data.due_date;
44+
this.implementation_details = data.implementation_details;
45+
this.evidence_description = data.evidence_description;
46+
this.feedback_description = data.feedback_description;
47+
this.evidence_files = data.evidence_files;
48+
this.feedback_files = data.feedback_files;
49+
this.control_id = data.control_id;
50+
this.is_demo = data.is_demo;
51+
this.created_at = data.created_at;
52+
}
53+
54+
static createSubControl(data: SubControlModel): SubControlModel {
55+
return new SubControlModel(data);
56+
}
57+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export class SubscriptionModel {
2+
id?: number;
3+
organization_id!: number;
4+
tier_id!: number;
5+
stripe_sub_id!: string;
6+
status!: "active" | "inactive" | "canceled";
7+
start_date!: Date;
8+
end_date?: Date;
9+
created_at!: Date;
10+
updated_at!: Date;
11+
12+
constructor(data: SubscriptionModel) {
13+
this.id = data.id;
14+
this.organization_id = data.organization_id;
15+
this.tier_id = data.tier_id;
16+
this.stripe_sub_id = data.stripe_sub_id;
17+
this.status = data.status;
18+
this.start_date = data.start_date;
19+
this.end_date = data.end_date;
20+
this.created_at = data.created_at;
21+
this.updated_at = data.updated_at;
22+
}
23+
24+
static createSubscription(data: SubscriptionModel): SubscriptionModel {
25+
return new SubscriptionModel(data);
26+
}
27+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export class SubtopicModel {
2+
id?: number;
3+
title!: string;
4+
order_no?: number;
5+
topic_id!: number;
6+
is_demo?: boolean;
7+
created_at?: Date;
8+
9+
constructor(data: SubtopicModel) {
10+
this.id = data.id;
11+
this.title = data.title;
12+
this.order_no = data.order_no;
13+
this.topic_id = data.topic_id;
14+
this.is_demo = data.is_demo;
15+
this.created_at = data.created_at;
16+
}
17+
18+
static createSubtopic(data: SubtopicModel): SubtopicModel {
19+
return new SubtopicModel(data);
20+
}
21+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { TaskPriority, TaskStatus } from "../../interfaces/i.task";
2+
3+
export class TaskModel {
4+
id?: number;
5+
title!: string;
6+
description?: string;
7+
creator_id!: number;
8+
organization_id!: number;
9+
due_date?: Date;
10+
priority!: TaskPriority;
11+
status!: TaskStatus;
12+
categories?: string[];
13+
created_at?: Date;
14+
updated_at?: Date;
15+
16+
constructor(data: TaskModel) {
17+
this.id = data.id;
18+
this.title = data.title;
19+
this.description = data.description;
20+
this.creator_id = data.creator_id;
21+
this.organization_id = data.organization_id;
22+
this.due_date = data.due_date;
23+
this.priority = data.priority;
24+
this.status = data.status;
25+
this.categories = data.categories;
26+
this.created_at = data.created_at;
27+
this.updated_at = data.updated_at;
28+
}
29+
30+
static createTask(data: TaskModel): TaskModel {
31+
return new TaskModel(data);
32+
}
33+
}

0 commit comments

Comments
 (0)