Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility method getProjectVersionImplementationStatus #150

Merged
merged 1 commit into from
Jun 24, 2024
Merged

Conversation

Pl217
Copy link
Contributor

@Pl217 Pl217 commented Jun 21, 2024

implementationStatus is not a real column on projectVersion table, but rather a function that computes implementation status and can return one of four string values. Since using DB functions is considered legacy, this method recreates the logic in code.

For the record, the DB function we're recreating looks like this:

CREATE FUNCTION public."implementationStatus"(
  public."projectVersion"
) RETURNS CHARACTER VARYING
    LANGUAGE SQL STABLE
    AS $_$
SELECT
  (
    CASE
      WHEN "project"."currentPublishedVersionId" = $1."id" THEN 'published'
      WHEN "project"."currentPublishedVersionId" IS NULL
      AND $1."id" = "project"."latestVersionId" THEN 'unpublished'
      WHEN "project"."currentPublishedVersionId" IS NOT NULL
      AND $1."id" = "project"."latestVersionId" THEN 'draft'
      ELSE 'archived'
    END
  )
FROM
  "project"
WHERE
  "project"."id" = $1."projectId" $_$;

@Pl217 Pl217 added the ready for review All comments have been addressed, and the Pull Request is ready for review label Jun 21, 2024
@Pl217 Pl217 requested a review from a team as a code owner June 21, 2024 09:04
@enxtur enxtur assigned Pl217 and unassigned enxtur Jun 24, 2024
@enxtur enxtur added ready for merge Review and testing is complete. It is ready for merging as soon as CI has finished. and removed ready for review All comments have been addressed, and the Pull Request is ready for review labels Jun 24, 2024
@Pl217 Pl217 merged commit 7963527 into develop Jun 24, 2024
2 checks passed
@Pl217 Pl217 deleted the HPC-9121 branch June 24, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for merge Review and testing is complete. It is ready for merging as soon as CI has finished.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants