Skip to content

Commit

Permalink
[ZARS-685][ADD] add base path for proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
af-egr committed Dec 11, 2024
1 parent 35a7b9c commit c6188d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/proposal/utils/proposal.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import { Proposal } from '../schema/proposal.schema';
import { UploadDto } from '../dto/upload.dto';
import { ReportDto } from '../dto/proposal/report.dto';

const getBasePath = (proposalId: string, type: UploadType): string => `proposal/${proposalId}/${type}/`;

export const getBlobName = (proposalId: string, type: UploadType, subId?: string): string => {
return `proposal/${proposalId}/${type}/${getSubPath(subId)}${uuid()}`;
return `${getBasePath(proposalId, type)}${getSubPath(subId)}${uuid()}`;
};

export const getProposalBlobName = (proposalId: string, projectAbbreviation: string, type: UploadType) => {
if (type === UseCaseUpload.ProposalPDF) {
const blobInstanceName = `${projectAbbreviation}_proposal`;

return `proposal/${proposalId}/${type}/${blobInstanceName}`;
return `${getBasePath(proposalId, type)}${blobInstanceName}`;
}

throw new Error(
Expand Down

0 comments on commit c6188d1

Please sign in to comment.