Skip to content

Commit

Permalink
fix(lbac-2266): findone applicant (#1730)
Browse files Browse the repository at this point in the history
* fix: findOne applicant

* fix: sort result for $last to work correctly
  • Loading branch information
kevbarns authored Dec 26, 2024
1 parent 0e9ab12 commit 38e69af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type ApplicationAggregate = {
export const up = async () => {
const applications = (await getDbCollection("applications")
.aggregate([
{
$sort: { created_at: 1 },
},
{
$group: {
_id: "$applicant_email",
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/applicant.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IApplicant, IApplicantNew } from "shared"

import { getDbCollection } from "../common/utils/mongodbUtils"

export const getApplicantFromDB = (payload: Filter<IApplicant>) => getDbCollection("applicants").findOne({ payload })
export const getApplicantFromDB = (filter: Filter<IApplicant>) => getDbCollection("applicants").findOne(filter)

const updateApplicant = (applicantId: ObjectId, update: MatchKeysAndValues<IApplicant>) => getDbCollection("applicants").updateOne({ _id: applicantId }, { $set: update })

Expand Down

0 comments on commit 38e69af

Please sign in to comment.