-
Notifications
You must be signed in to change notification settings - Fork 111
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 parentId parameter in core/front apis #9261
Conversation
|
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.
If the array is called parents I wonder if we should just call it parent vs parent_id ?
front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts
Outdated
Show resolved
Hide resolved
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.
Thinking more about it, I really think we want to name it parent
given that the other field is named parents
.../pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/parents.ts
Outdated
Show resolved
Hide resolved
front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/tables/index.ts
Show resolved
Hide resolved
I find this more consistent to have parent_id (or parentId) as we do for document_id / folder_id / table_id and we're more clear on the fact we're not passing (or receiving) an object. And as the other fields "parents" is going to be removed at some point I don't think we need to align on that one ? |
Well Stripe does not use Really think the |
Other than upsert flow do we already have any _id parameters? |
We do have |
Even for table upsert this should be a post to /tabe/{tableId} not a post to /tables :/ this API is a mess |
Let's make sure to have a proper upsert path for folders That way we can standardize on create something and you're given an id: POST .../thing |
IMO parent_id is more suited here:
I think when I say "thing" I refer to the whole thing, and when I say "thing_id" I refer to its id is the most sensible and the convergence point we should aim at for consitency in the API (and in naming in general) Are you strong on removing _id @spolu ? |
💯 |
as per IRL stong feeling from @philipperolet to keep parent_id. Fine to go with it under the argument that we already have fileId |
Thanks; I'd be ok to take renaming |
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.
Left a batch of coms 👍
front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/tables/index.ts
Show resolved
Hide resolved
core/src/data_sources/data_source.rs
Outdated
@@ -686,7 +691,8 @@ impl DataSource { | |||
title.as_deref().unwrap_or(document_id), | |||
mime_type.as_deref().unwrap_or("application/octet-stream"), | |||
&tags, | |||
&parents, | |||
parents.get(1).cloned(), |
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.
This one seems off?
@@ -142,6 +142,7 @@ pub struct Document { | |||
pub title: String, | |||
pub mime_type: String, | |||
pub tags: Vec<String>, | |||
pub parent_id: Option<String>, |
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.
why diff this file for now?
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.
don't we want to return the parent_id here ?
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.
seen irl with @philipperolet , to be consistent we want to add parent_id in return too
@@ -6,6 +6,7 @@ pub struct Folder { | |||
folder_id: String, | |||
timestamp: u64, | |||
title: String, | |||
parent_id: Option<String>, |
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.
why diff here for now?
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.
Good for me 👍
Left a few coms, not requiring changes (but check them out :) )
Description
Adds parent_id in core and front API , in request when upserting a doc/table/folder and in document/table/folder response.
parent_id is not stored in database but we only ensure the value is equals to parents[1].
Risk
Errors when upserting documents/tables/folders. If parent_id is not passed (which is the case for now), nothing should change. Can be rolledback
Deploy Plan
deploy
core
then deploy
front