[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP | Refactor existing parser using typescript #164

Open
wants to merge 7 commits into
base: vue3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Define ADR and DecisionOutcome models
  • Loading branch information
Efode-r2d2 committed Jun 11, 2024
commit 1f84a84e7a1916a6311236db367d24c3a4ffc4dd
15 changes: 15 additions & 0 deletions src/__tests__/adr.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { describe, it, expect } from 'vitest'
import {ArchitecturalDecisionRecord} from "../infrastructure/domain/model/ArchitecturalDecisionRecord";

describe('Test ADR Model', () => {
it('renders properly', () => {
const adr = new ArchitecturalDecisionRecord(
["Option One"],
"Context and problem statement",
"20-2-2020",
"deciders"
);
console.log(adr.consideredOptions[0]);
console.log(adr.links);
})
})
149 changes: 112 additions & 37 deletions src/infrastructure/domain/model/ArchitecturalDecisionRecord.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,118 @@
import {DecisionOutcome} from "@/infrastructure/domain/model/DecisionOutcome";

interface DecisionOutcome {
chosenOption: string;
explanation: string;
positiveConsequences: string[];
negativeConsequences: string[];
}
export class ArchitecturalDecisionRecord{
private _consideredOptions: any[];
private _contextAndProblemStatement: string;
private _date: string;
private _deciders: string;
private _decisionDrivers: string[];
private _decisionOutcome: DecisionOutcome;
private _links: string[];
private _status: string;
private _technicalStory:string;
private _title:string;

class ArchitecturalDecisionRecord{
private title:string;
private status: string;
private deciders: string;
private date: string;
private technicalStory:string;
private contextAndProblemStatement: string;
private decisionDrivers: string[];
private consideredOptions: any[];
private decisionOutcome: DecisionOutcome;
private links: string[];
constructor(consideredOptions?:any[],
contextAndProblemStatement?: string,
date?:string,
deciders?:string,
decisionDrivers?:string[],
decisionOutcome?:DecisionOutcome,
links?:string[],
status?:string,
technicalStory?: string,
title?:string,
constructor(consideredOptions: any[] = [],
contextAndProblemStatement: string = '',
date: string = '',
deciders: string = '',
decisionDrivers: string[] = [],
decisionOutcome: DecisionOutcome = null,
links: string[] = [],
status: string = '',
technicalStory: string = '',
title: string = ''
) {
this.consideredOptions = consideredOptions;
this.contextAndProblemStatement =contextAndProblemStatement;
this.date = date;
this.deciders = deciders;
this.decisionDrivers = decisionDrivers;
this.decisionOutcome = decisionOutcome;
this.links = links;
this.status = status;
this.technicalStory = technicalStory;
this.title = title;
this._consideredOptions = consideredOptions;
this._contextAndProblemStatement = contextAndProblemStatement;
this._date = date;
this._deciders = deciders;
this._decisionDrivers = decisionDrivers;
this._decisionOutcome = decisionOutcome;
this._links = links;
this._status = status;
this._technicalStory = technicalStory;
this._title = title;
}


get consideredOptions(): any[] {
return this._consideredOptions;
}

set consideredOptions(value: any[]) {
this._consideredOptions = value;
}

get contextAndProblemStatement(): string {
return this._contextAndProblemStatement;
}

set contextAndProblemStatement(value: string) {
this._contextAndProblemStatement = value;
}

get date(): string {
return this._date;
}

set date(value: string) {
this._date = value;
}

get deciders(): string {
return this._deciders;
}

set deciders(value: string) {
this._deciders = value;
}

get decisionDrivers(): string[] {
return this._decisionDrivers;
}

set decisionDrivers(value: string[]) {
this._decisionDrivers = value;
}

get decisionOutcome(): DecisionOutcome {
return this._decisionOutcome;
}

set decisionOutcome(value: DecisionOutcome) {
this._decisionOutcome = value;
}

get links(): string[] {
return this._links;
}

set links(value: string[]) {
this._links = value;
}

get status(): string {
return this._status;
}

set status(value: string) {
this._status = value;
}

get technicalStory(): string {
return this._technicalStory;
}

set technicalStory(value: string) {
this._technicalStory = value;
}

get title(): string {
return this._title;
}

set title(value: string) {
this._title = value;
}
}
47 changes: 47 additions & 0 deletions src/infrastructure/domain/model/DecisionOutcome.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export class DecisionOutcome{
private _chosenOption: string;
private _explanation: string;
private _positiveConsequences: string[];
private _negativeConsequences: string[];


constructor(chosenOption: string = '', explanation: string ='', positiveConsequences: string[] = [], negativeConsequences: string[]=[]) {
this._chosenOption = chosenOption;
this._explanation = explanation;
this._positiveConsequences = positiveConsequences;
this._negativeConsequences = negativeConsequences;
}


get chosenOption(): string {
return this._chosenOption;
}

set chosenOption(value: string) {
this._chosenOption = value;
}

get explanation(): string {
return this._explanation;
}

set explanation(value: string) {
this._explanation = value;
}

get positiveConsequences(): string[] {
return this._positiveConsequences;
}

set positiveConsequences(value: string[]) {
this._positiveConsequences = value;
}

get negativeConsequences(): string[] {
return this._negativeConsequences;
}

set negativeConsequences(value: string[]) {
this._negativeConsequences = value;
}
}