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

feat: SRS-540-Backend #117

Merged
merged 7 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
7 changes: 4 additions & 3 deletions backend/sites/src/app/entities/eventPartics.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export class EventPartics extends ChangeAuditEntity {
})
whenUpdated: Date | null;

@Field()
@Column('smallint', { name: 'rwm_flag' })
rwmFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_flag', nullable: true })
rwmFlag: number | null;

@ManyToOne(
() => EventParticRoleCd,
Expand Down
14 changes: 8 additions & 6 deletions backend/sites/src/app/entities/events.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ export class Events extends ChangeAuditEntity {
})
whenUpdated: Date | null;

@Field()
@Column('smallint', { name: 'rwm_flag' })
rwmFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_flag', nullable: true })
rwmFlag: number | null;

@Field()
@Column('smallint', { name: 'rwm_note_flag' })
rwmNoteFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_note_flag', nullable: true })
rwmNoteFlag: number | null;

@Field({ nullable: true })
@Column('timestamp without time zone', {
Expand Down
16 changes: 9 additions & 7 deletions backend/sites/src/app/entities/siteAssocs.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ export class SiteAssocs extends ChangeAuditEntity {
})
whenUpdated: Date | null;

@Field()
@Column('smallint', { name: 'rwm_flag' })
rwmFlag: number;

@Field()
@Column('smallint', { name: 'rwm_note_flag' })
rwmNoteFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_flag', nullable: true })
rwmFlag: number | null;

//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_note_flag', nullable: true })
rwmNoteFlag: number | null;

@Field()
@Column('character varying', { name: 'common_pid', length: 1 })
Expand Down
7 changes: 4 additions & 3 deletions backend/sites/src/app/entities/siteParticRoles.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ export class SiteParticRoles extends ChangeAuditEntity {
})
whenUpdated: Date | null;

@Field()
@Column('smallint', { name: 'rwm_flag' })
rwmFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_flag', nullable: true })
rwmFlag: number | null;

@Field(() => ParticRoleCd)
@ManyToOne(() => ParticRoleCd, (particRoleCd) => particRoleCd.siteParticRoles)
Expand Down
45 changes: 26 additions & 19 deletions backend/sites/src/app/entities/sitePartics.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ export class SitePartics extends ChangeAuditEntity {
})
whenUpdated: Date | null;

@Field()
@Column('smallint', { name: 'rwm_flag' })
rwmFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_flag', nullable: true })
rwmFlag: number | null;

@Field()
@Column('smallint', { name: 'rwm_note_flag' })
rwmNoteFlag: number;
//Make this nullable because we are not using it anymore and keeing it for historical data
@Field({ nullable: true })
@Column('smallint', { name: 'rwm_note_flag', nullable: true })
rwmNoteFlag: number | null;

//Commented this as event participant is no longer depends on site participant
//Uncomment the code in cases there will be migartion issue from oracle
Expand All @@ -96,21 +98,26 @@ export class SitePartics extends ChangeAuditEntity {
@JoinColumn([{ name: 'site_id', referencedColumnName: 'id' }])
site: Sites;

@OneToMany(
() => SiteProfileOwners,
(siteProfileOwners) => siteProfileOwners.sp,
)
siteProfileOwners: SiteProfileOwners[];
// As per our discussion regarding the deletion of a site participant,
// it is important to note that other related entities should remain unaffected.
// Removing this participant may lead to synchronization issues with oracle.
// Therefore, this code has been commented out to prevent potential complications in the future.

// @OneToMany(
// () => SiteProfileOwners,
// (siteProfileOwners) => siteProfileOwners.sp,
// )
// siteProfileOwners: SiteProfileOwners[];

@OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.completorPartic)
siteProfiles: SiteProfiles[];
// @OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.completorPartic)
// siteProfiles: SiteProfiles[];

@OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.contactPartic)
siteProfiles2: SiteProfiles[];
// @OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.contactPartic)
// siteProfiles2: SiteProfiles[];

@OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.rwmPartic)
siteProfiles3: SiteProfiles[];
// @OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.rwmPartic)
// siteProfiles3: SiteProfiles[];

@OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.siteRegPartic)
siteProfiles4: SiteProfiles[];
// @OneToMany(() => SiteProfiles, (siteProfiles) => siteProfiles.siteRegPartic)
// siteProfiles4: SiteProfiles[];
}
11 changes: 8 additions & 3 deletions backend/sites/src/app/entities/siteProfileOwners.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ export class SiteProfileOwners {
// ])
// siteProfiles: SiteProfiles;

@ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfileOwners)
@JoinColumn([{ name: 'sp_id', referencedColumnName: 'id' }])
sp: SitePartics;
// As per our discussion regarding the deletion of a site participant,
// it is important to note that other related entities should remain unaffected.
// Removing this participant may lead to synchronization issues with oracle.
// Therefore, this code has been commented out to prevent potential complications in the future.

// @ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfileOwners)
// @JoinColumn([{ name: 'sp_id', referencedColumnName: 'id' }])
// sp: SitePartics;
}
34 changes: 22 additions & 12 deletions backend/sites/src/app/entities/siteProfiles.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,23 +366,33 @@ export class SiteProfiles extends ChangeAuditEntity {
// )
// siteProfileOwners: SiteProfileOwners[];

@ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles)
@JoinColumn([{ name: 'completor_partic_id', referencedColumnName: 'id' }])
completorPartic: SitePartics;
// As per our discussion regarding the deletion of a site participant,
// it is important to note that other related entities should remain unaffected.
// Removing this participant may lead to synchronization issues with oracle.
// Therefore, this code has been commented out to prevent potential complications in the future.

@ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles2)
@JoinColumn([{ name: 'contact_partic_id', referencedColumnName: 'id' }])
contactPartic: SitePartics;
// @ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles)
// @JoinColumn([{ name: 'completor_partic_id', referencedColumnName: 'id' }])
// completorPartic: SitePartics;

@ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles3)
@JoinColumn([{ name: 'rwm_partic_id', referencedColumnName: 'id' }])
rwmPartic: SitePartics;
// @ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles2)
// @JoinColumn([{ name: 'contact_partic_id', referencedColumnName: 'id' }])
// contactPartic: SitePartics;

// @ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles3)
// @JoinColumn([{ name: 'rwm_partic_id', referencedColumnName: 'id' }])
// rwmPartic: SitePartics;

@ManyToOne(() => Sites, (sites) => sites.siteProfiles)
@JoinColumn([{ name: 'site_id', referencedColumnName: 'id' }])
site: Sites;

@ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles4)
@JoinColumn([{ name: 'site_reg_partic_id', referencedColumnName: 'id' }])
siteRegPartic: SitePartics;
// As per our discussion regarding the deletion of a site participant,
// it is important to note that other related entities should remain unaffected.
// Removing this participant may lead to synchronization issues with oracle.
// Therefore, this code has been commented out to prevent potential complications in the future.

// @ManyToOne(() => SitePartics, (sitePartics) => sitePartics.siteProfiles4)
// @JoinColumn([{ name: 'site_reg_partic_id', referencedColumnName: 'id' }])
// siteRegPartic: SitePartics;
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('CartResolver', () => {
}),
},
},
LoggerService
LoggerService,
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Test } from '@nestjs/testing';
import { LandHistoryResponse } from '../../dto/landHistory.dto';
import { LoggerService } from '../../logger/logger.service';


describe('LandHistoryResolver', () => {
let resolver: LandHistoryResolver;
let landHistoryService: LandHistoryService;
Expand Down Expand Up @@ -41,7 +40,7 @@ describe('LandHistoryResolver', () => {
),
},
},
LoggerService
LoggerService,
],
}).compile();

Expand Down Expand Up @@ -78,7 +77,12 @@ describe('LandHistoryResolver', () => {
.spyOn(landHistoryService, 'getLandHistoriesForSite')
.mockResolvedValueOnce(mockLandHistories);

const result = await resolver.getLandHistoriesForSite('1', '', 'ASC',showPending);
const result = await resolver.getLandHistoriesForSite(
'1',
'',
'ASC',
showPending,
);

expect(result).toEqual(expectedResponse);
expect(genericResponseProvider.createResponse).toHaveBeenCalledWith(
Expand All @@ -104,7 +108,12 @@ describe('LandHistoryResolver', () => {
.spyOn(landHistoryService, 'getLandHistoriesForSite')
.mockResolvedValueOnce([]);

const result = await resolver.getLandHistoriesForSite(siteId, '', 'ASC',showPending);
const result = await resolver.getLandHistoriesForSite(
siteId,
'',
'ASC',
showPending,
);

expect(result).toEqual(expectedResponse);
expect(genericResponseProvider.createResponse).toHaveBeenCalledWith(
Expand Down
2 changes: 1 addition & 1 deletion backend/sites/src/app/services/cart/cart.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('CartSerive', () => {
})),
},
},
LoggerService
LoggerService,
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('DropdownService', () => {
{
provide: getRepositoryToken(User),
useClass: Repository,
}
},
],
}).compile();

Expand Down
4 changes: 2 additions & 2 deletions backend/sites/src/app/services/folio/folio.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('FolioSerivce', () => {
let folioContentService: FolioContentsService;
let folioRepository: Repository<Folio>;
let folioContentRepository: Repository<FolioContents>;
let loggerService: LoggerService
let loggerService: LoggerService;

const folios: Folio[] = [
{
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('FolioSerivce', () => {
provide: getRepositoryToken(FolioContents),
useClass: Repository,
},
LoggerService
LoggerService,
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('LandHistoryService', () => {
provide: REQUEST,
useValue: { req: { user: mockUser } },
},
LoggerService
LoggerService,
],
}).compile();

Expand All @@ -75,7 +75,12 @@ describe('LandHistoryService', () => {
it('should call LandHistories repository with correct data', async () => {
const siteId = 'site123';
const showPending = false;
await landHistoryService.getLandHistoriesForSite(siteId, '', 'ASC',showPending);
await landHistoryService.getLandHistoriesForSite(
siteId,
'',
'ASC',
showPending,
);

expect(whereMock).toHaveBeenCalledWith('site_id = :siteId', {
siteId,
Expand Down
Loading
Loading