Skip to content

Commit

Permalink
Run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
DJensen94 committed Mar 19, 2024
1 parent de2971c commit 6db08d1
Show file tree
Hide file tree
Showing 29 changed files with 2,069 additions and 2,170 deletions.
12 changes: 5 additions & 7 deletions backend/src/models/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ import {
Ticket,
TrustymailScan,
VulnScan

} from '.';

let connection: Connection | null = null;

let dl_connection: Connection | null = null;

const connectDl = async (logging?:boolean) => {
const connectDl = async (logging?: boolean) => {
const dl_connection = createConnection({
type: 'postgres',
host: process.env.MDL_HOST,
Expand Down Expand Up @@ -90,15 +89,14 @@ const connectDl = async (logging?:boolean) => {
logging: logging ?? false,
cache: true
});
return dl_connection
}
return dl_connection;
};

export const connectToDatalake = async (logging?: boolean) => {
if (!dl_connection?.isConnected) {
dl_connection = await connectDl(logging);
}
else {
console.log("didn't connect")
} else {
console.log("didn't connect");
}
return dl_connection;
};
Expand Down
8 changes: 4 additions & 4 deletions backend/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export * from './organization-tag';
export * from './mini_data_lake/cert_scans';
export * from './mini_data_lake/cidrs';
export * from './mini_data_lake/contacts';
export {Cpe as DL_Cpe} from './mini_data_lake/cpes';
export {Cve as DL_Cve} from './mini_data_lake/cves';
export {Domain as DL_Domain} from './mini_data_lake/domains';
export { Cpe as DL_Cpe } from './mini_data_lake/cpes';
export { Cve as DL_Cve } from './mini_data_lake/cves';
export { Domain as DL_Domain } from './mini_data_lake/domains';
export * from './mini_data_lake/host_scans';
export * from './mini_data_lake/hosts';
export * from './mini_data_lake/ips';
export * from './mini_data_lake/kevs';
export * from './mini_data_lake/locations';
export {Organization as DL_Organization} from './mini_data_lake/organizations';
export { Organization as DL_Organization } from './mini_data_lake/organizations';
export * from './mini_data_lake/port_scans';
export * from './mini_data_lake/precert_scans';
export * from './mini_data_lake/reports';
Expand Down
75 changes: 35 additions & 40 deletions backend/src/models/mini_data_lake/cert_scans.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,56 @@
// The data in this table is derived from the Vulnerability Scans Database,
// The data in this table is derived from the Vulnerability Scans Database,
// the [certs Collection] (https://github.com/cisagov/ncats-data-dictionary/blob/develop/NCATS_Data_Dictionary.md#certs-collection).

import {
Entity,
Column,
PrimaryColumn,
BaseEntity,
ManyToMany,
JoinTable
} from 'typeorm';
Entity,
Column,
PrimaryColumn,
BaseEntity,
ManyToMany,
JoinTable
} from 'typeorm';

import {Domain} from "./domains"
import { Domain } from './domains';

@Entity()
export class CertScan extends BaseEntity {
@PrimaryColumn()
id: string
id: string;

@Column({
nullable: true,
type: 'varchar'
})
issuer: string | null;
nullable: true,
type: 'varchar'
})
issuer: string | null;

@Column({ nullable: true, type: 'timestamp' })
expirationTimestamp: Date | null;

@Column({ nullable: true, type: 'timestamp' })
certStartTimestamp: Date | null;

@Column({
nullable: true,
type: 'varchar'
})
pem: string | null;
nullable: true,
type: 'varchar'
})
pem: string | null;

@Column()
sctExists: boolean;
sctExists: boolean;

@Column({ nullable: true, type: 'timestamp' })
sctOrNotBefore: Date | null;
sctOrNotBefore: Date | null;

@Column({
nullable: true,
type: 'varchar'
})
serial: string | null;

@ManyToMany(
(type) => Domain,
(domain) => domain.certScans,
{
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
}
)
@JoinTable()
domains: Domain[];
nullable: true,
type: 'varchar'
})
serial: string | null;

@ManyToMany((type) => Domain, (domain) => domain.certScans, {
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
})
@JoinTable()
domains: Domain[];
}
86 changes: 38 additions & 48 deletions backend/src/models/mini_data_lake/cidrs.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,58 @@
import {
Entity,
Index,
Column,
PrimaryColumn,
CreateDateColumn,
BaseEntity,
ManyToMany,
JoinTable
} from 'typeorm';
Entity,
Index,
Column,
PrimaryColumn,
CreateDateColumn,
BaseEntity,
ManyToMany,
JoinTable
} from 'typeorm';

import {Request } from './requests';
import { Request } from './requests';
import { Organization } from './organizations';
@Entity()
export class Cidr extends BaseEntity {
@PrimaryColumn()
id: string
id: string;

@CreateDateColumn()
createdDate: Date;
createdDate: Date;

@Index()
@Column({
nullable: true,
type: 'cidr',
unique: true
})
network: string | null;
nullable: true,
type: 'cidr',
unique: true
})
network: string | null;

@Column({
nullable: true,
type: 'inet'
})
startIp: string | null;
nullable: true,
type: 'inet'
})
startIp: string | null;

@Column({
nullable: true,
type: 'inet'
})
endIp: string | null;
nullable: true,
type: 'inet'
})
endIp: string | null;

@Column({nullable: true})
retired: boolean;
@Column({ nullable: true })
retired: boolean;

@ManyToMany(
(type) => Request,
(request) => request.cidrs,
{
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
}
)
@ManyToMany((type) => Request, (request) => request.cidrs, {
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
})
@JoinTable()
requests: Request[];

@ManyToMany(
(type) => Organization,
(org) => org.cidrs,
{
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
}
)
@ManyToMany((type) => Organization, (org) => org.cidrs, {
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
})
@JoinTable()
organizations: Organization[];


}
}
87 changes: 41 additions & 46 deletions backend/src/models/mini_data_lake/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,52 @@
// the [requests Collection] (https://github.com/cisagov/ncats-data-dictionary/blob/develop/NCATS_Data_Dictionary.md#requests-collection).

import {
Entity,
Column,
PrimaryGeneratedColumn,
BaseEntity,
ManyToMany,
Unique,
JoinTable
} from 'typeorm';
import {Organization} from './organizations'
Entity,
Column,
PrimaryGeneratedColumn,
BaseEntity,
ManyToMany,
Unique,
JoinTable
} from 'typeorm';
import { Organization } from './organizations';
@Entity()
@Unique(['name','email','type'])
@Unique(['name', 'email', 'type'])
export class Contact extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@PrimaryGeneratedColumn('uuid')
id: string;

@Column({
nullable: true,
type: 'varchar'
})
name: string | null;

@Column({
nullable: true,
type: 'varchar'
})
email: string | null;
@Column({
nullable: true,
type: 'varchar'
})
name: string | null;

@Column({
nullable: true,
type: 'varchar'
})
phoneNumber: string | null;
@Column({
nullable: true,
type: 'varchar'
})
email: string | null;

@Column({
nullable: true,
type: 'varchar'
})
type: string | null;
@Column({
nullable: true,
type: 'varchar'
})
phoneNumber: string | null;

@Column()
retired: boolean;
@Column({
nullable: true,
type: 'varchar'
})
type: string | null;

@ManyToMany(
(type) => Organization,
(org) => org.contacts,
{
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
}
)
@JoinTable()
organizations: Organization[];
@Column()
retired: boolean;

}
@ManyToMany((type) => Organization, (org) => org.contacts, {
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
})
@JoinTable()
organizations: Organization[];
}
Loading

0 comments on commit 6db08d1

Please sign in to comment.