Skip to content

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TIL-EBP committed Nov 6, 2024
1 parent 7327deb commit 852ef66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions apps/server-asset-sg/src/features/asset-edit/asset-edit.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class AssetEditRepo implements Repo<AssetEditDetail, number, AssetEditDat
assetKindItemCode: data.patch.assetKindItemCode,
assetFormatItemCode: data.patch.assetFormatItemCode,
isNatRel: data.patch.isNatRel,
assetMainId: O.toUndefined(data.patch.assetMainId) ?? null,
assetMainId: O.toNullable(data.patch.assetMainId),
lastProcessedDate: new Date(),
processor: data.user.email,
manCatLabelRefs: {
Expand Down Expand Up @@ -326,7 +326,7 @@ export class AssetEditRepo implements Repo<AssetEditDetail, number, AssetEditDat
for (const assetYId of data.patch.siblingAssetIds) {
const siblingCandidate = await this.prismaService.asset.findUnique({
where: { assetId: assetYId },
select: { assetId: true, workgroupId: true },
select: { workgroupId: true },
});
if (siblingCandidate?.workgroupId !== data.patch.workgroupId) {
throw new Error('Sibling assets must be in the same workgroup as the edited asset');
Expand All @@ -338,7 +338,7 @@ export class AssetEditRepo implements Repo<AssetEditDetail, number, AssetEditDat
if (assetMainId) {
const assetMain = await this.prismaService.asset.findUnique({
where: { assetId: assetMainId },
select: { assetId: true, workgroupId: true, titlePublic: true },
select: { workgroupId: true },
});
if (assetMain?.workgroupId !== data.patch.workgroupId) {
throw new Error('Cannot assign parent asset from different workgroup');
Expand All @@ -349,12 +349,12 @@ export class AssetEditRepo implements Repo<AssetEditDetail, number, AssetEditDat
if (id) {
const childAssets = await this.prismaService.asset.findMany({
where: { assetMainId: id },
select: { assetId: true, workgroupId: true, titlePublic: true },
select: { workgroupId: true },
});

for (const child of childAssets) {
if (child.workgroupId !== data.patch.workgroupId) {
throw new Error('The subordinate assets must be in the same workgroups as the parent asset');
throw new Error('Child assets must be in the same workgroup as the parent asset');
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const initialAssetEditorTabGeneralState: AssetEditorTabGeneralState = {
})
export class AssetEditorTabGeneralComponent implements OnInit {
private readonly rootFormGroupDirective = inject(FormGroupDirective);
protected readonly rootFormGroup: AssetEditorFormGroup = this.rootFormGroupDirective.control;
private readonly rootFormGroup: AssetEditorFormGroup = this.rootFormGroupDirective.control;
private readonly formBuilder = inject(FormBuilder);
private readonly focusMonitor = inject(FocusMonitor);

Expand Down

0 comments on commit 852ef66

Please sign in to comment.