-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: blur company reviews for users w/o access 🚫 (#487)
- Loading branch information
Showing
6 changed files
with
79 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/core/src/modules/employment/queries/has-review-access.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { db } from '@oyster/db'; | ||
|
||
/** | ||
* Checks if a student has review access by checking if they have a work | ||
* experience and company review. | ||
* | ||
* @param studentId - The ID of the student to check. | ||
* @returns True if the student has review access, false otherwise. | ||
*/ | ||
export async function hasReviewAccess(studentId: string): Promise<boolean> { | ||
const workExperience = await db | ||
.selectFrom('workExperiences') | ||
.where('studentId', '=', studentId) | ||
.executeTakeFirst(); | ||
|
||
if (!workExperience) { | ||
return true; | ||
} | ||
|
||
const companyReview = await db | ||
.selectFrom('companyReviews') | ||
.where('studentId', '=', studentId) | ||
.executeTakeFirst(); | ||
|
||
return !!companyReview; | ||
} |
21 changes: 0 additions & 21 deletions
21
packages/core/src/modules/member/use-cases/has-review-access.ts
This file was deleted.
Oops, something went wrong.