Skip to content

[EdgeDB] Pin queries #3208

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

Closed
wants to merge 27 commits into from
Closed

[EdgeDB] Pin queries #3208

wants to merge 27 commits into from

Conversation

adam-soltech
Copy link
Contributor

@adam-soltech adam-soltech commented May 10, 2024

Monday task

https://seed-company-squad.monday.com/boards/5989610236/pulses/5792971662

Description

Ready for review checklist

Use [N/A] if the item is not applicable to this PR or remove the item

  • Change the task url above to the actual Monday task
  • Add/update tests if needed
  • Add reviewers to this PR

@adam-soltech adam-soltech marked this pull request as ready for review May 10, 2024 18:55
@adam-soltech adam-soltech requested a review from CarsonF as a code owner May 10, 2024 18:55
export class PinEdgeDBRepository implements PublicOf<PinRepository> {
constructor(@Inject(Client) private readonly client: Client) {}

async isPinned(id: ID, session: Session): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

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

@CarsonF - Since the schema itself defines a pinned property that is automatically inherited by any type that implements the Pinnable abstract type, doesn't that make this isPinned method unneeded in the EdgeDB world?

Copy link
Member

Choose a reason for hiding this comment

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

The pinned property is a computed shortcut.
User.pins holds the links for the Pinnable objects that user has pinned.
So this could query cast the ID to the Pinnable instance and then check the pinned property on it.
That uses the current user global which has already been connected in the app code in another layer.

select (<Pinnable><uuid>$id).pinned

Or

with obj := <Pinnable><uuid>$id
select obj.pinned

Copy link
Member

@CarsonF CarsonF left a comment

Choose a reason for hiding this comment

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

Was this a paste from AI? BaseNode, PinnedRelation, pinned_by don't exist within our schema.

Pins can be adjusted by += or -= from the User.pins link.

update global currentUser
set {
  pins += <Mixin::Pinnable><uuid>$id
}

Though QB is preferred. Look at the other edgedb repos in the codebase for examples.

Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed since Pinnable isn't a Resource.

Comment on lines 8 to 9
export class PinEdgeDBRepository implements PublicOf<PinRepository> {
constructor(@Inject(Client) private readonly client: Client) {}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export class PinEdgeDBRepository implements PublicOf<PinRepository> {
constructor(@Inject(Client) private readonly client: Client) {}
export class PinEdgeDBRepository
extends CommonRepository
implements PublicOf<PinRepository> {

@CarsonF CarsonF changed the title chore: add pinnable edgedb query [EdgeDB] Pin queries May 20, 2024
CarsonF and others added 21 commits May 28, 2024 19:57
Co-authored-by: Carson Full <carson_full@tsco.org>
- Use ~/common & ~/core
- Import/export DTOs always from their folder instead of rollup to component folder
- Stop rolling up database (neo4j) to core
- Shorten where possible
This allows certain code paths to use a changed url after app init.
@CarsonF CarsonF deleted the agl/edgedb-pin-queries branch July 1, 2024 21:54
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.

7 participants