diff --git a/backend/src/models/connection.ts b/backend/src/models/connection.ts index ec8c8cd3..bfb83abf 100644 --- a/backend/src/models/connection.ts +++ b/backend/src/models/connection.ts @@ -1,19 +1,21 @@ import { createConnection, Connection } from 'typeorm'; import { + ApiKey, + Cpe, + Cve, Domain, - Service, - Vulnerability, - Scan, Organization, - User, + OrganizationTag, Role, - ScanTask, - Webpage, - ApiKey, + RscQuestion, + RscResource, SavedSearch, - OrganizationTag, - Cpe, - Cve + Scan, + ScanTask, + Service, + User, + Vulnerability, + Webpage } from '.'; let connection: Connection | null = null; @@ -27,20 +29,22 @@ const connectDb = async (logging?: boolean) => { password: process.env.DB_PASSWORD, database: process.env.DB_NAME, entities: [ + ApiKey, Cpe, Cve, Domain, - Service, - Vulnerability, - Scan, Organization, - User, + OrganizationTag, Role, - ScanTask, - Webpage, - ApiKey, + RscQuestion, + RscResource, SavedSearch, - OrganizationTag + Scan, + ScanTask, + Service, + User, + Vulnerability, + Webpage ], synchronize: false, name: 'default', diff --git a/backend/src/models/index.ts b/backend/src/models/index.ts index 310cfb76..9615cbad 100644 --- a/backend/src/models/index.ts +++ b/backend/src/models/index.ts @@ -1,15 +1,17 @@ -export * from './domain'; -export * from './cve'; -export * from './cpe'; -export * from './service'; +export * from './api-key'; export * from './connection'; -export * from './vulnerability'; -export * from './scan'; +export * from './cpe'; +export * from './cve'; +export * from './domain'; export * from './organization'; -export * from './user'; +export * from './organization-tag'; export * from './role'; +export * from './rsc_question'; +export * from './rsc_resource'; +export * from './saved-search'; +export * from './scan'; export * from './scan-task'; +export * from './service'; +export * from './user'; +export * from './vulnerability'; export * from './webpage'; -export * from './api-key'; -export * from './saved-search'; -export * from './organization-tag'; diff --git a/backend/src/models/rsc_question.ts b/backend/src/models/rsc_question.ts new file mode 100644 index 00000000..b8488ff9 --- /dev/null +++ b/backend/src/models/rsc_question.ts @@ -0,0 +1,20 @@ +import { + BaseEntity, + Column, + Entity, + OneToMany, + PrimaryGeneratedColumn +} from 'typeorm'; +import { RscResource } from './rsc_resource'; + +@Entity() +export class RscQuestion extends BaseEntity { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column() + name: string; + + @OneToMany(() => RscResource, (resource) => resource.question) + resources: RscResource[]; +} diff --git a/backend/src/models/rsc_resource.ts b/backend/src/models/rsc_resource.ts new file mode 100644 index 00000000..cfd330f1 --- /dev/null +++ b/backend/src/models/rsc_resource.ts @@ -0,0 +1,26 @@ +import { + BaseEntity, + Column, + Entity, + ManyToOne, + PrimaryGeneratedColumn +} from 'typeorm'; +import { RscQuestion } from './rsc_question'; + +@Entity() +export class RscResource extends BaseEntity { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column() + title: string; + + @Column() + text: string; + + @Column() + url: string; + + @ManyToOne(() => RscQuestion, (question) => question.resources) + question: RscQuestion; +} diff --git a/backend/src/models/user.ts b/backend/src/models/user.ts index 8a9cdc5f..1aa72b5e 100644 --- a/backend/src/models/user.ts +++ b/backend/src/models/user.ts @@ -10,14 +10,15 @@ import { PrimaryGeneratedColumn, BeforeUpdate } from 'typeorm'; -import { Organization, Role } from './'; +import { Role } from './'; import { ApiKey } from './api-key'; export enum UserType { - STANDARD = 'standard', GLOBAL_VIEW = 'globalView', GLOBAL_ADMIN = 'globalAdmin', - REGIONAL_ADMIN = 'regionalAdmin' + REGIONAL_ADMIN = 'regionalAdmin', + READY_SET_CYBER = 'readySetCyber', + STANDARD = 'standard' } @Entity() export class User extends BaseEntity { @@ -115,16 +116,4 @@ export class User extends BaseEntity { nullable: true }) state: string; - - // @Column({ - // nullable: true, - // default: 0 - // }) - // numberOfOrganizations: number; - - // @Column({ - // nullable: true, - // default: [] - // }) - // organizationIds: Array; }