Skip to content

Commit

Permalink
Merge pull request #3328 from SeedCompany/0286-growth-plan-upload-fai…
Browse files Browse the repository at this point in the history
…lure
  • Loading branch information
CarsonF authored Nov 11, 2024
2 parents 42bae6f + 7d9d7db commit c1af809
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
38 changes: 24 additions & 14 deletions src/components/engagement/engagement.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,20 @@ export class EngagementRepository extends CommonRepository {

if (pnp) {
const engagement = await this.readOne(id, session);
if (engagement.pnp) {
await this.files.createFileVersion(
{
...pnp,
parentId: engagement.pnp.id,
},
session,

if (!engagement.pnp) {
throw new ServerException(
'Expected PnP file to be created with the engagement',
);
}

await this.files.createFileVersion(
{
...pnp,
parentId: engagement.pnp.id,
},
session,
);
}

if (changes.firstScripture) {
Expand Down Expand Up @@ -417,15 +422,20 @@ export class EngagementRepository extends CommonRepository {

if (growthPlan) {
const engagement = await this.readOne(id, session);
if (engagement.growthPlan) {
await this.files.createFileVersion(
{
...growthPlan,
parentId: engagement.growthPlan.id,
},
session,

if (!engagement.growthPlan) {
throw new ServerException(
'Expected Growth Plan file to be created with the engagement',
);
}

await this.files.createFileVersion(
{
...growthPlan,
parentId: engagement.growthPlan.id,
},
session,
);
}

if (mentorId !== undefined) {
Expand Down
9 changes: 0 additions & 9 deletions src/components/engagement/engagement.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
} from '~/core';
import { Privileges } from '../authorization';
import { CeremonyService } from '../ceremony';
import { FileService } from '../file';
import { ProductService } from '../product';
import { ProductListInput, SecuredProductList } from '../product/dto';
import { ProjectService } from '../project';
Expand Down Expand Up @@ -52,7 +51,6 @@ export class EngagementService {
@Inject(forwardRef(() => ProductService))
private readonly products: ProductService & {},
private readonly config: ConfigService,
private readonly files: FileService,
private readonly engagementRules: EngagementRules,
private readonly privileges: Privileges,
@Inject(forwardRef(() => ProjectService))
Expand Down Expand Up @@ -210,13 +208,6 @@ export class EngagementService {
.for(session, InternshipEngagement, object)
.verifyChanges(changes, { pathPrefix: 'engagement' });

await this.files.updateDefinedFile(
object.growthPlan,
'engagement.growthPlan',
changes.growthPlan,
session,
);

const updated = await this.repo.updateInternship(
{ id: object.id, ...changes },
session,
Expand Down

0 comments on commit c1af809

Please sign in to comment.