fix(public-api): use schema fields order and type in V1BioLinksController
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- postgresql, typescript
- Domain
- backend-api-design, databases
Research direction
Read apps/api/src/public-api/controllers/v1-bio-links.controller.ts alongside the named models in packages/prisma/schema.prisma. Update the ordering fields, analytics filters, and URL validation described in the issue, then exercise the listed /v1/bio-links endpoints or their existing tests. Done means those endpoints run against the schema without Prisma field errors and reject URLs that do not use HTTP or HTTPS.
Written by the indexing model from the issue text.
Description
Problem Description
In apps/api/src/public-api/controllers/v1-bio-links.controller.ts, multiple /v1/bio-links endpoints query or write non-existent Prisma fields that do not match packages/prisma/schema.prisma, causing runtime Prisma validation errors on every call:
-
positionused instead oforder:getBioPageOrThrow(lines 35-38) passesorderBy: { position: 'asc' }forlinks,products,socialButtons, andfaqs.addLink(lines 104 & 113) readsl.positionand writesposition: maxPos + 1.- In
packages/prisma/schema.prisma,BioProduct,BioSocialButton,BioLink, andBioFaqall useorder(Int @default(0)), notposition.
-
eventTypeused instead oftype:getAnalytics(lines 170 & 173) queriesbioAnalyticsEvent.countwitheventType: 'PAGE_VIEW'andeventType: 'LINK_CLICK'.- In
packages/prisma/schema.prisma,BioAnalyticsEvent(line 1006) usestype(String // "view" or "click"), noteventType.
Expected Behavior
- All
/v1/bio-linksendpoints (GET /v1/bio-links,PATCH /v1/bio-links,GET/POST/DELETE /v1/bio-links/links,GET /v1/bio-links/products,GET /v1/bio-links/leads,GET /v1/bio-links/analytics) execute cleanly against the Prisma schema without runtime field errors. addLinkshould also validatebody.urluses anhttp:orhttps:scheme before saving.
Where to Look
apps/api/src/public-api/controllers/v1-bio-links.controller.ts(lines 31-49, 104-114, 162-189)packages/prisma/schema.prisma(BioProduct,BioSocialButton,BioLink,BioFaq,BioAnalyticsEvent)
Solution / Implementation Guide
- In
getBioPageOrThrow(lines 35-38), replaceorderBy: { position: 'asc' }withorderBy: { order: 'asc' }onlinks,products,socialButtons, andfaqs. - In
addLink(lines 104-114), replacel.positionwithl.orderandposition: maxPos + 1withorder: maxOrder + 1(and validatebody.urlis a validhttp:/https:URL). - In
getAnalytics(lines 170 & 173), replaceeventType: 'PAGE_VIEW'withtype: 'view'andeventType: 'LINK_CLICK'withtype: 'click'.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 6m
- Merged PRs (30d)
- 27
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sumamakhan761/tryinstance
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sumamakhan761/tryinstance#65 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
sumamakhan761/tryinstance#64 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
sumamakhan761/tryinstance#63 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sumamakhan761/tryinstance#62 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sumamakhan761/tryinstance#60 ·
Maintainers usually reply within 1 day
All issues in sumamakhan761/tryinstance
Similar issues
-
prio:low scope:hud
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OliverRomhagen/vrigstad-joyride#953 ·
Maintainers usually reply within 1 day
-
review-followup
Difficulty 1/5 Under an hour Newbie friendliness 92/100
griffinwork40/agent-afk#5446 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
kacper-szewczyk/Ticknest#346 ·
Maintainers usually reply within 1 day
-
echarts geo: a GeoJSON URL that returns 200 with a body that is not JSON is fetched on each refreshOpenbug plugin/echarts/geo
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Yeachan-Heo/gajae-code#8230 ·
Maintainers usually reply within 1 day