colorstackorg/oyster

Check for Reviews Access ๐Ÿง

Closed this issue ยท 2 comments

Description

See #316 for project overview.

To determine if a user has access to reviews, we need to implement a function that checks if a member has posted at least one review for a work experience, or does not have any work experiences.

Acceptance Criteria

Implements a function named hasReviewsAccess that takes a member id as a parameter and checks if the user has permissions to view the companies page.

The function should return a bool with the following logic:

  • If member has no work experience, return True
  • If member has work experience and has written a review for at least one of their experiences, return True
  • If member has work experience but has NOT written any reviews, return False

Additional Context:

All of the data needed is stored within the databases (specifically the tables work_experiences and company_reviews) which can be explored further with the command psql postgresql://oyster:oyster@localhost:5433/oyster. This is the command-line interface for interacting with PostgreSQL.

This function should (tentatively) be stored in a new file named has-review-access.ts in packages/core/src/modules/member/use-cases.

๐Ÿ™‹๐Ÿฝโ€โ™€๏ธ

Pull request otw!