Skip to content

Commit

Permalink
fix(apply-jobpost): incorporate feedback
Browse files Browse the repository at this point in the history
- remove 'submitted' status
- add comments for 'rejected status'
  • Loading branch information
jkarenzi committed Dec 1, 2024
1 parent 328dfce commit cf16af8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/models/JobApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ const jobApplicationSchema = new mongoose.Schema({
},
status:{
type:String,
enum:['submitted','under-review','accepted','rejected'],
default:'submitted'
enum:['under-review','accepted','rejected'],
default:'under-review'
},
comment: {
type:String,
required: false
}
},{timestamps:true})

Expand Down
13 changes: 10 additions & 3 deletions src/resolvers/jobApplicationResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ interface getOneFormData {

interface statusData {
applicationId: string,
status: string
status: string,
comment: string
}

const formatDate = (date:Date) => {
Expand Down Expand Up @@ -114,6 +115,7 @@ export const jobApplicationResolver = {
essay: application.essay,
resume: application.resume,
status: application.status,
comment: application.comment,
jobId: application.jobId,
createdAt: formatDate(application.createdAt)
}
Expand Down Expand Up @@ -175,8 +177,13 @@ export const jobApplicationResolver = {
);
}

const { status, applicationId } = input
await JobApplication.findByIdAndUpdate(applicationId, {status})
const { status, applicationId, comment } = input
if(comment){
await JobApplication.findByIdAndUpdate(applicationId, {status, comment})
}else{
await JobApplication.findByIdAndUpdate(applicationId, {status})
}

const application = await JobApplication.findOne({_id:applicationId}).populate('userId').populate('jobId')
return application
}
Expand Down
2 changes: 2 additions & 0 deletions src/schema/jobApplicationSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const jobApplicationTypeDefs = gql`
essay: String!
resume: String!
status: String!
comment: String
createdAt: String!
}
Expand All @@ -39,6 +40,7 @@ export const jobApplicationTypeDefs = gql`
input StatusInput {
applicationId: ID!
status: String!
comment: String
}
type checkIfUserAppliedOutput {
Expand Down

0 comments on commit cf16af8

Please sign in to comment.