Skip to content

Commit

Permalink
Merge branch 'main' into PIMS-1333-addParcelService
Browse files Browse the repository at this point in the history
  • Loading branch information
TaylorFries authored Feb 21, 2024
2 parents 1415c9d + dd84989 commit 578e9a6
Show file tree
Hide file tree
Showing 71 changed files with 1,214 additions and 1,217 deletions.
1 change: 1 addition & 0 deletions express-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"reflect-metadata": "0.2.1",
"swagger-ui-express": "5.0.0",
"typeorm": "0.3.17",
"typeorm-naming-strategies": "4.1.0",
"winston": "3.11.0",
"zod": "3.22.4"
},
Expand Down
2 changes: 2 additions & 0 deletions express-api/src/appDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DataSource } from 'typeorm';
import { CustomWinstonLogger } from '@/typeorm/utilities/CustomWinstonLogger';
import dotenv from 'dotenv';
import { resolve } from 'path';
import { SnakeNamingStrategy } from 'typeorm-naming-strategies';
import Entities from '@/typeorm/entitiesIndex';

dotenv.config({ path: resolve(__dirname, '../../.env') });
Expand Down Expand Up @@ -29,4 +30,5 @@ export const AppDataSource = new DataSource({
entities: Entities,
migrations: ['./src/typeorm/Migrations/Seeds/*.ts', './src/typeorm/Migrations/*.ts'],
subscribers: [],
namingStrategy: new SnakeNamingStrategy(),
});
12 changes: 6 additions & 6 deletions express-api/src/typeorm/Entities/AccessRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export class AccessRequest extends BaseEntity {
Id: number;

// User Relations
@Column({ name: 'UserId', type: 'uuid' })
@Column({ name: 'user_id', type: 'uuid' })
UserId: UUID;

@ManyToOne(() => User, (User) => User.Id)
@JoinColumn({ name: 'UserId' })
@JoinColumn({ name: 'user_id' })
@Index()
User: User;

Expand All @@ -27,18 +27,18 @@ export class AccessRequest extends BaseEntity {
Status: number;

// Role Relations
@Column({ name: 'RoleId', type: 'uuid' })
@Column({ name: 'role_id', type: 'uuid' })
RoleId: UUID;

@ManyToOne(() => Role, (Role) => Role.Id)
@JoinColumn({ name: 'RoleId' })
@JoinColumn({ name: 'role_id' })
Role: Role;

// Agency Relations
@Column({ name: 'AgencyId', type: 'int' })
@Column({ name: 'agency_id', type: 'int' })
AgencyId: number;

@ManyToOne(() => Agency, (Agency) => Agency.Id)
@JoinColumn({ name: 'AgencyId' })
@JoinColumn({ name: 'agency_id' })
Agency: Agency;
}
8 changes: 4 additions & 4 deletions express-api/src/typeorm/Entities/AdministrativeArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ export class AdministrativeArea extends BaseEntity {
SortOrder: number;

// Regional District Relations
@Column({ name: 'RegionalDistrictId', type: 'int' })
@Column({ name: 'regional_district_id', type: 'int' })
@Index()
RegionalDistrictId: number;

@ManyToOne(() => RegionalDistrict, (RegionalDistrict) => RegionalDistrict.Id)
@JoinColumn({ name: 'RegionalDistrictId' })
@JoinColumn({ name: 'regional_district_id' })
RegionalDistrict: RegionalDistrict;

// Province Relations
@Column({ name: 'ProvinceId', type: 'character varying', length: 2 })
@Column({ name: 'province_id', type: 'character varying', length: 2 })
@Index()
ProvinceId: string;

@ManyToOne(() => Province, (Province) => Province.Id)
@JoinColumn({ name: 'ProvinceId' })
@JoinColumn({ name: 'province_id' })
Province: Province;
}
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/Agency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export class Agency extends BaseEntity {
Description: string;

// Parent Agency Relations
@Column({ name: 'ParentId', type: 'int', nullable: true })
@Column({ name: 'parent_id', type: 'int', nullable: true })
ParentId: number;

@ManyToOne(() => Agency, (agency) => agency.Id)
@JoinColumn({ name: 'ParentId' })
@JoinColumn({ name: 'parent_id' })
@Index()
Parent: Agency;

Expand Down
12 changes: 6 additions & 6 deletions express-api/src/typeorm/Entities/Building.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ import { Property } from '@/typeorm/Entities/abstractEntities/Property';
@Entity()
export class Building extends Property {
// Construction Type Relations
@Column({ name: 'BuildingConstructionTypeId', type: 'int' })
@Column({ name: 'building_construction_type_id', type: 'int' })
BuildingConstructionTypeId: number;

@ManyToOne(() => BuildingConstructionType, (ConstructionType) => ConstructionType.Id)
@JoinColumn({ name: 'BuildingConstructionTypeId' })
@JoinColumn({ name: 'building_construction_type_id' })
@Index()
BuildingConstructionType: BuildingConstructionType;

@Column({ type: 'int' })
BuildingFloorCount: number;

// Predominate Use Relations
@Column({ name: 'BuildingPredominateUseId', type: 'int' })
@Column({ name: 'building_predominate_use_id', type: 'int' })
BuildingPredominateUseId: number;

@ManyToOne(() => BuildingPredominateUse, (PredominateUse) => PredominateUse.Id)
@JoinColumn({ name: 'BuildingPredominateUseId' })
@JoinColumn({ name: 'building_predominate_use_id' })
@Index()
BuildingPredominateUse: BuildingPredominateUse;

Expand All @@ -38,11 +38,11 @@ export class Building extends Property {
RentableArea: number;

// Occupant Type Relations
@Column({ name: 'BuildingOccupantTypeId', type: 'int' })
@Column({ name: 'building_occupant_type_id', type: 'int' })
BuildingOccupantTypeId: number;

@ManyToOne(() => BuildingOccupantType, (OccupantType) => OccupantType.Id)
@JoinColumn({ name: 'BuildingOccupantTypeId' })
@JoinColumn({ name: 'building_occupant_type_id' })
@Index()
BuildingOccupantType: BuildingOccupantType;

Expand Down
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/BuildingEvaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Entity, Index, ManyToOne, JoinColumn, PrimaryColumn } from 'typeorm';
@Entity()
@Index(['BuildingId', 'EvaluationKey'])
export class BuildingEvaluation extends Evaluation {
@PrimaryColumn({ name: 'BuildingId', type: 'int' })
@PrimaryColumn({ name: 'building_id', type: 'int' })
BuildingId: number;

@ManyToOne(() => Building, (Building) => Building.Id)
@JoinColumn({ name: 'BuildingId' })
@JoinColumn({ name: 'building_id' })
Building: Building;
}
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/BuildingFiscal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Building } from '@/typeorm/Entities/Building';

@Entity()
export class BuildingFiscal extends Fiscal {
@PrimaryColumn({ name: 'BuildingId', type: 'int' })
@PrimaryColumn({ name: 'building_id', type: 'int' })
@Index()
BuildingId: number;

@ManyToOne(() => Building, (Building) => Building.Id)
@JoinColumn({ name: 'BuildingId' })
@JoinColumn({ name: 'building_id' })
Building: Building;
}
12 changes: 6 additions & 6 deletions express-api/src/typeorm/Entities/NotificationQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@ export class NotificationQueue extends BaseEntity {
Tag: string;

// Project Relation
@Column({ name: 'ProjectId', type: 'int' })
@Column({ name: 'project_id', type: 'int' })
ProjectId: number;

@ManyToOne(() => Project, (Project) => Project.Id)
@JoinColumn({ name: 'ProjectId' })
@JoinColumn({ name: 'project_id' })
Project: Project;

// Agency Relation
@Column({ name: 'ToAgencyId', type: 'int' })
@Column({ name: 'to_agency_id', type: 'int' })
ToAgencyId: number;

@ManyToOne(() => Agency, (Agency) => Agency.Id)
@JoinColumn({ name: 'ToAgencyId' })
@JoinColumn({ name: 'to_agency_id' })
@Index()
ToAgency: Agency;

// Template Relation
@Column({ name: 'TemplateId', type: 'int' })
@Column({ name: 'template_id', type: 'int' })
TemplateId: number;

@ManyToOne(() => NotificationTemplate, (Template) => Template.Id)
@JoinColumn({ name: 'TemplateId' })
@JoinColumn({ name: 'template_id' })
@Index()
Template: NotificationTemplate;

Expand Down
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/Parcel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export class Parcel extends Property {
@Column({ type: 'boolean' })
NotOwned: boolean;

@Column({ name: 'ParentParcelId', type: 'int', nullable: true })
@Column({ name: 'parent_parcel_id', type: 'int', nullable: true })
ParentParcelId: number;

@ManyToOne(() => Parcel, (Parcel) => Parcel.Id)
@JoinColumn({ name: 'ParentParcelId' })
@JoinColumn({ name: 'parent_parcel_id' })
ParentParcel: Parcel;
}
8 changes: 4 additions & 4 deletions express-api/src/typeorm/Entities/ParcelBuilding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { Building } from '@/typeorm/Entities/Building';

@Entity()
export class ParcelBuilding extends BaseEntity {
@PrimaryColumn({ name: 'ParcelId', type: 'int' })
@PrimaryColumn({ name: 'parcel_id', type: 'int' })
ParcelId: number;

@ManyToOne(() => Parcel, (Parcel) => Parcel.Id)
@JoinColumn({ name: 'ParcelId' })
@JoinColumn({ name: 'parcel_id' })
Parcel: Parcel;

@PrimaryColumn({ name: 'BuildingId', type: 'int' })
@PrimaryColumn({ name: 'building_id', type: 'int' })
BuildingId: number;

@ManyToOne(() => Building, (Building) => Building.Id)
@JoinColumn({ name: 'BuildingId' })
@JoinColumn({ name: 'building_id' })
Building: Building;
}
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/ParcelEvaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Entity, Column, Index, ManyToOne, JoinColumn, PrimaryColumn } from 'typ
@Entity()
@Index(['ParcelId', 'EvaluationKey'])
export class ParcelEvaluation extends Evaluation {
@PrimaryColumn({ name: 'ParcelId', type: 'int' })
@PrimaryColumn({ name: 'parcel_id', type: 'int' })
ParcelId: number;

@ManyToOne(() => Parcel, (Parcel) => Parcel.Id)
@JoinColumn({ name: 'ParcelId' })
@JoinColumn({ name: 'parcel_id' })
Parcel: Parcel;

@Column({ type: 'character varying', length: 150, nullable: true })
Expand Down
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/ParcelFiscal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Parcel } from '@/typeorm/Entities/Parcel';

@Entity()
export class ParcelFiscal extends Fiscal {
@PrimaryColumn({ name: 'ParcelId', type: 'int' })
@PrimaryColumn({ name: 'parcel_id', type: 'int' })
@Index()
ParcelId: number;

@ManyToOne(() => Parcel, (Parcel) => Parcel.Id)
@JoinColumn({ name: 'ParcelId' })
@JoinColumn({ name: 'parcel_id' })
Parcel: Parcel;
}
20 changes: 10 additions & 10 deletions express-api/src/typeorm/Entities/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,47 +66,47 @@ export class Project extends BaseEntity {
ProjectType: number;

// Workflow Relation
@Column({ name: 'WorkflowId', type: 'int' })
@Column({ name: 'workflow_id', type: 'int' })
WorkflowId: number;

@ManyToOne(() => Workflow, (Workflow) => Workflow.Id)
@JoinColumn({ name: 'WorkflowId' })
@JoinColumn({ name: 'workflow_id' })
@Index()
Workflow: Workflow;

// Agency Relation
@Column({ name: 'AgencyId', type: 'int' })
@Column({ name: 'agency_id', type: 'int' })
AgencyId: number;

@ManyToOne(() => Agency, (Agency) => Agency.Id)
@JoinColumn({ name: 'AgencyId' })
@JoinColumn({ name: 'agency_id' })
@Index()
Agency: Agency;

// Tier Level Relation
@Column({ name: 'TierLevelId', type: 'int' })
@Column({ name: 'tier_level_id', type: 'int' })
TierLevelId: number;

@ManyToOne(() => TierLevel, (TierLevel) => TierLevel.Id)
@JoinColumn({ name: 'TierLevelId' })
@JoinColumn({ name: 'tier_level_id' })
@Index()
TierLevel: TierLevel;

// Status Relation
@Column({ name: 'StatusId', type: 'int' })
@Column({ name: 'status_id', type: 'int' })
StatusId: number;

@ManyToOne(() => ProjectStatus, (Status) => Status.Id)
@JoinColumn({ name: 'StatusId' })
@JoinColumn({ name: 'status_id' })
@Index()
Status: ProjectStatus;

// Risk Relation
@Column({ name: 'RiskId', type: 'int' })
@Column({ name: 'risk_id', type: 'int' })
RiskId: number;

@ManyToOne(() => ProjectRisk, (Risk) => Risk.Id)
@JoinColumn({ name: 'RiskId' })
@JoinColumn({ name: 'risk_id' })
@Index()
Risk: ProjectRisk;
}
12 changes: 6 additions & 6 deletions express-api/src/typeorm/Entities/ProjectAgencyResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ import { Agency } from './Agency';
@Entity()
export class ProjectAgencyResponse extends BaseEntity {
// Project Relation
@PrimaryColumn({ name: 'ProjectId', type: 'int' })
@PrimaryColumn({ name: 'project_id', type: 'int' })
ProjectId: number;

@ManyToOne(() => Project, (Project) => Project.Id)
@JoinColumn({ name: 'ProjectId' })
@JoinColumn({ name: 'project_id' })
Project: Project;

// Agency Relation
@PrimaryColumn({ name: 'AgencyId', type: 'int' })
@PrimaryColumn({ name: 'agency_id', type: 'int' })
AgencyId: number;

@ManyToOne(() => Agency, (Agency) => Agency.Id)
@JoinColumn({ name: 'AgencyId' })
@JoinColumn({ name: 'agency_id' })
Agency: Agency;

@Column({ type: 'money' })
OfferAmount: number;

// Notification Relation
@Column({ name: 'NotificationId', type: 'int' })
@Column({ name: 'notification_id', type: 'int' })
NotificationId: number;

@ManyToOne(() => NotificationQueue, (Notification) => Notification.Id, { nullable: true })
@JoinColumn({ name: 'NotificationId' })
@JoinColumn({ name: 'notification_id' })
@Index()
Notification: NotificationQueue;

Expand Down
4 changes: 2 additions & 2 deletions express-api/src/typeorm/Entities/ProjectNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class ProjectNote extends BaseEntity {
Id: number;

// Project Relation
@Column({ name: 'ProjectId', type: 'int' })
@Column({ name: 'project_id', type: 'int' })
ProjectId: number;

@ManyToOne(() => Project, (Project) => Project.Id)
@JoinColumn({ name: 'ProjectId' })
@JoinColumn({ name: 'project_id' })
Project: Project;

@Column('int')
Expand Down
Loading

0 comments on commit 578e9a6

Please sign in to comment.