Skip to content

Commit

Permalink
#247 Applicant upload documents in Cycles Application (#155)
Browse files Browse the repository at this point in the history
* Tranee upload and view documents

* Ft notifications tickets cycle (#135)

* add new models and seeders

* application tickets

* fix model

* add filter tickets resolver

* ticket create-notifications

* allow multiple replies from admin and applicant

* fix ticket resolver

* fix update ticket resolver

* ticket notifications-email

* ticket notifications

* Application cycle process on applicant

* application stage notifications

* ft-notifications-email-applicant-tickets-application-stages

* update

* ft-notifications-tickets-cycle

* update

* fix schema

* fix nullable author field

* merge develop

* missing imports

* resolved conflicts

---------

Co-authored-by: uwituzeb <[email protected]>
Co-authored-by: chris <[email protected]>
Co-authored-by: Aime-Patrick <[email protected]>

* Tranee upload and view documents

---------

Co-authored-by: Christian Iradukunda <[email protected]>
Co-authored-by: uwituzeb <[email protected]>
Co-authored-by: chris <[email protected]>
Co-authored-by: Aime-Patrick <[email protected]>
  • Loading branch information
5 people authored Nov 21, 2024
1 parent 014e807 commit 71ba3b6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
13 changes: 13 additions & 0 deletions src/models/traineeApplicant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ const TraineeApplicantSchema = new Schema(
type: Schema.Types.ObjectId,
ref: "cohortModel",
},
coverLetterUrl: {
type: String,
required: false
},
idDocumentUrl: {
type: String,
required: false
},
resumeUrl: {
type: String,
required: false
}

},
{
timestamps: true,
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/traineeApplicantResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const traineeApplicantResolver: any = {

const formattedTrainees = allTrainee.map((trainee) => ({
...trainee.toObject(),
createdAt: trainee.createdAt.toLocaleString(), // Format createdAt as ISO string
createdAt: trainee.createdAt.toLocaleString(),
}));
return {
data: formattedTrainees,
Expand Down Expand Up @@ -128,12 +128,11 @@ export const traineeApplicantResolver: any = {
}
},
async createNewTraineeApplicant(_: any, { input }: any, context: any) {
const { lastName, firstName, email, cycle_id, attributes } = input;
const { lastName, firstName, email, cycle_id, attributes, coverLetterUrl, idDocumentUrl, resumeUrl } = input;
const userWithRole = await LoggedUserModel.findById(
context.currentUser?._id
).populate("role");

// Validate email
const validateEmail = (email: string) => {
return String(email)
.toLowerCase()
Expand All @@ -150,7 +149,6 @@ export const traineeApplicantResolver: any = {

const session = await mongoose.startSession();
session.startTransaction();

try {
const cycle = await applicationCycle
.findById(cycle_id)
Expand Down Expand Up @@ -178,7 +176,6 @@ export const traineeApplicantResolver: any = {
});
await existingTrainee.save({ session });
await session.commitTransaction();
//populating traineeApplicant with cycle_id
return await TraineeApplicant.findById(existingTrainee._id).populate(
"cycle_id"
);
Expand All @@ -194,6 +191,9 @@ export const traineeApplicantResolver: any = {
cycle: cycle_id,
},
],
idDocumentUrl,
coverLetterUrl,
resumeUrl
});
// Create the corresponding traineEAttributes
if (
Expand Down
5 changes: 4 additions & 1 deletion src/schema/applicationStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export const applicationStageDefs = gql`
applicationPhase: String
status: String
_id:String
createdAt:String
createdAt: String
coverLetterUrl: String
resumeUrl: String
idDocumentUrl: String
}
type Cycles {
name: String
Expand Down
6 changes: 6 additions & 0 deletions src/schema/traineeApplicantSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export const typeDefsTrainee = gql`
role: Role
createdAt: String!
user: User
coverLetterUrl: String!
idDocumentUrl: String!
resumeUrl: String!
}
type CycleApplied {
Expand Down Expand Up @@ -80,6 +83,9 @@ export const typeDefsTrainee = gql`
cycle_id: ID!
role: ID
attributes: traineeAttributeInput
coverLetterUrl:String
idDocumentUrl:String
resumeUrl:String
}
input traineeApplicantEmail {
Expand Down

0 comments on commit 71ba3b6

Please sign in to comment.