GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feature/create watchlist API endpoints by KenTandrian · Pull Request #4570 · ghostfolio/ghostfolio

Conversation

@KenTandrian

@KenTandrian KenTandrian commented Apr 19, 2025

Copy link
Copy Markdown
Contributor

Hi @dtslvr, this PR is to resolve issue #4564. Please take a look :)

Changes

  • Added 3 permissions for watchlist API and enable them by default for ADMIN role.
  • Add watchlist API endpoints.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
dtslvr
dtslvr requested changes Apr 20, 2025
View reviewed changes

@dtslvr dtslvr left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for your additional contribution, @KenTandrian! 👍🏻

I have reviewed the changes and added a few comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/api/src/app/endpoints/watchlists/create-watchlist-item.dto.ts
import { IsEnum, IsString } from 'class-validator';

export class CreateWatchlistItemDto {
@IsEnum(DataSource)

@dtslvr dtslvr Apr 20, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Here we use @IsEnum(DataSource, { each: true }). Which approach is optimal?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@KenTandrian KenTandrian Apr 20, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Screenshot 2025-04-20 at 22 50 09

If I understand correctly, it is mentioned here that each: true means that the validated value (dataSource) is an array and each of its items must be validated. Since dataSource is not an array, I don't think it is necessary?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/api/src/app/endpoints/watchlists/watchlist.controller.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/api/src/app/endpoints/watchlists/watchlist.controller.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/api/src/app/endpoints/watchlists/watchlist.service.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/api/src/app/endpoints/watchlists/watchlist.service.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/api/src/app/endpoints/watchlists/watchlist.service.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/api/src/app/endpoints/watchlists/watchlist.service.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/api/src/app/endpoints/watchlists/watchlist.service.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread libs/common/src/lib/permissions.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread libs/common/src/lib/permissions.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@KenTandrian

KenTandrian commented Apr 20, 2025

Copy link
Copy Markdown
Contributor Author

Hi @dtslvr, a little context on each: true:

I found out that each property will only take effect when the value is an array. Here is what I saw when I tried to add a validate step and tested it with Postman:

With each: true: 201 Created.
Screenshot 2025-04-20 at 22 59 43

Without each: 400 Bad Request.
Screenshot 2025-04-20 at 22 58 33

In our case, since dataSource is a string, I believe setting each property is not necessary.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dtslvr

dtslvr commented Apr 21, 2025

Copy link
Copy Markdown
Member

Hi @dtslvr, a little context on each: true:
...
In our case, since dataSource is a string, I believe setting each property is not necessary.

Thanks for the research, @KenTandrian! I have created a PR to harmonize the DTOs: #4581

KenTandrian reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

KenTandrian and others added 8 commits April 21, 2025 19:53
@KenTandrian @dtslvr
feat(lib): add permissions for watchlist API
47b7f90
@KenTandrian @dtslvr
feat(api): add watchlist API endpoints
13388d2
@KenTandrian @dtslvr
feat(lib): enable permissions for admin
6bb04e4
@KenTandrian @dtslvr
resolve comments
260e6f0
@KenTandrian @dtslvr
feat(lib): change permission name
80a8b0f
@KenTandrian @dtslvr
feat(lib): enable permissions for user role
03c4a99
@KenTandrian @dtslvr
fix(api): remove each
64ac4d0
@dtslvr
Various improvements
d29ba01
@dtslvr
dtslvr force-pushed the feature/create-watchlist-api-endpoints branch from 1df8f39 to d29ba01 Compare April 21, 2025 17:56
dtslvr added 2 commits April 21, 2025 19:56
@dtslvr
Update changelog
23c618f
@dtslvr
Reorder imports
332aae1
dtslvr
dtslvr approved these changes Apr 21, 2025
View reviewed changes

@dtslvr dtslvr left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks a lot for your contribution, @KenTandrian! 🙌🏻
Ready to merge now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dtslvr
dtslvr merged commit 416fa44 into ghostfolio:main Apr 21, 2025
@dtslvr dtslvr linked an issue Apr 21, 2025 that may be closed by this pull request
Create watchlist API endpoints #4564
Closed
@dtslvr dtslvr mentioned this pull request Apr 21, 2025
Create watchlist API endpoints #4564
Closed
@KenTandrian
KenTandrian deleted the feature/create-watchlist-api-endpoints branch April 22, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dtslvr dtslvr dtslvr approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Create watchlist API endpoints

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@KenTandrian @dtslvr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.