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

[recnet-api] Add new api endpoint: get single rec by id #293

Merged
merged 3 commits into from
Sep 22, 2024

Conversation

swh00tw
Copy link
Collaborator

@swh00tw swh00tw commented Sep 20, 2024

Description

Add new API endpoint GET /recs/rec/:id

Related Issue

Notes

TODO

  • Paste the testing link
  • Clear console.log or console.error for debug usage
  • Update the documentation recnet-docs if needed
  • Version bump in package.json if needed

Copy link

vercel bot commented Sep 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
recnet ⬜️ Ignored (Inspect) Visit Preview Sep 22, 2024 3:36pm
recnet-docs ⬜️ Ignored (Inspect) Visit Preview Sep 22, 2024 3:36pm

@@ -12,6 +12,15 @@ import { getNextCutOff } from "@recnet/recnet-date-fns";
export default class RecRepository {
constructor(private readonly prisma: PrismaConnectionProvider) {}

public async findRecById(recId: string): Promise<Rec | null> {
return this.prisma.recommendation.findUnique({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Maybe you can use findUniqueOrThrow if this is not a normal use case. But the error handling in recnet.exception.filter.ts should be modified a bit.

Copy link
Collaborator Author

@swh00tw swh00tw Sep 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I originally use findUniqueOrThrow but when testing, the error code I saw was "2001" which is "User not found". I forget to modify recnet.exception.filter.ts. No wonder.

@swh00tw swh00tw merged commit 01921b5 into dev Sep 22, 2024
4 checks passed
@swh00tw swh00tw deleted the feat/get-rec-by-id branch January 9, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants