Skip to content

Commit 71ba3b6

Browse files
ndahimana154iChris-tianuwituzebchrisAime-Patrick
authored
#247 Applicant upload documents in Cycles Application (#155)
* 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]>
1 parent 014e807 commit 71ba3b6

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

Diff for: src/models/traineeApplicant.ts

+13
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ const TraineeApplicantSchema = new Schema(
6262
type: Schema.Types.ObjectId,
6363
ref: "cohortModel",
6464
},
65+
coverLetterUrl: {
66+
type: String,
67+
required: false
68+
},
69+
idDocumentUrl: {
70+
type: String,
71+
required: false
72+
},
73+
resumeUrl: {
74+
type: String,
75+
required: false
76+
}
77+
6578
},
6679
{
6780
timestamps: true,

Diff for: src/resolvers/traineeApplicantResolver.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const traineeApplicantResolver: any = {
5252

5353
const formattedTrainees = allTrainee.map((trainee) => ({
5454
...trainee.toObject(),
55-
createdAt: trainee.createdAt.toLocaleString(), // Format createdAt as ISO string
55+
createdAt: trainee.createdAt.toLocaleString(),
5656
}));
5757
return {
5858
data: formattedTrainees,
@@ -128,12 +128,11 @@ export const traineeApplicantResolver: any = {
128128
}
129129
},
130130
async createNewTraineeApplicant(_: any, { input }: any, context: any) {
131-
const { lastName, firstName, email, cycle_id, attributes } = input;
131+
const { lastName, firstName, email, cycle_id, attributes, coverLetterUrl, idDocumentUrl, resumeUrl } = input;
132132
const userWithRole = await LoggedUserModel.findById(
133133
context.currentUser?._id
134134
).populate("role");
135135

136-
// Validate email
137136
const validateEmail = (email: string) => {
138137
return String(email)
139138
.toLowerCase()
@@ -150,7 +149,6 @@ export const traineeApplicantResolver: any = {
150149

151150
const session = await mongoose.startSession();
152151
session.startTransaction();
153-
154152
try {
155153
const cycle = await applicationCycle
156154
.findById(cycle_id)
@@ -178,7 +176,6 @@ export const traineeApplicantResolver: any = {
178176
});
179177
await existingTrainee.save({ session });
180178
await session.commitTransaction();
181-
//populating traineeApplicant with cycle_id
182179
return await TraineeApplicant.findById(existingTrainee._id).populate(
183180
"cycle_id"
184181
);
@@ -194,6 +191,9 @@ export const traineeApplicantResolver: any = {
194191
cycle: cycle_id,
195192
},
196193
],
194+
idDocumentUrl,
195+
coverLetterUrl,
196+
resumeUrl
197197
});
198198
// Create the corresponding traineEAttributes
199199
if (

Diff for: src/schema/applicationStage.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export const applicationStageDefs = gql`
4040
applicationPhase: String
4141
status: String
4242
_id:String
43-
createdAt:String
43+
createdAt: String
44+
coverLetterUrl: String
45+
resumeUrl: String
46+
idDocumentUrl: String
4447
}
4548
type Cycles {
4649
name: String

Diff for: src/schema/traineeApplicantSchema.ts

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export const typeDefsTrainee = gql`
4040
role: Role
4141
createdAt: String!
4242
user: User
43+
coverLetterUrl: String!
44+
idDocumentUrl: String!
45+
resumeUrl: String!
4346
}
4447
4548
type CycleApplied {
@@ -80,6 +83,9 @@ export const typeDefsTrainee = gql`
8083
cycle_id: ID!
8184
role: ID
8285
attributes: traineeAttributeInput
86+
coverLetterUrl:String
87+
idDocumentUrl:String
88+
resumeUrl:String
8389
}
8490
8591
input traineeApplicantEmail {

0 commit comments

Comments
 (0)