-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: add new column for user and group to backend #1090
base: main
Are you sure you want to change the base?
Conversation
232b63c
to
731c09b
Compare
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.
Not sure if APIv1.feature needs to incorporate the new column too
@@ -38,6 +38,10 @@ class Version000700Date20230916000000 extends SimpleMigrationStep { | |||
'name' => 'selection', | |||
'db_type' => Types::TEXT, | |||
], | |||
[ | |||
'name' => 'usergroup', | |||
'db_type' => Types::TEXT, |
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.
I think for building more optimal queries it would actually be nice to have a different table format that not stores the entires in json as text but instead something like this
oc_tables_row_cells_usergroups
id | column_id | row_id | value | value_type |
---|---|---|---|---|
1 | 2 | 9 | alice | 0 |
2 | 2 | 9 | bob | 0 |
3 | 2 | 10 | engineering | 1 |
This might be more complex to build but we can do performant filtering on large tables by having an index on the value type and its exact match. For the value type using an integer (0 for user, 1 for group) is common from the server sharing API. Probably something to explore further then. Would be curious if @blizzz may have further thoughts on that.
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.
Seconded, as filtering is an important aspect.
Also Teams might be included in future.
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.
So to have a generic solutions that allows value_type in row_cells_xyz tables:
- A method like
lib/Migration/Version000700Date20230916000000::createRowValueTable()
or its optional extension to also add avalue_type
column. The$columns
array could be extended in that class. For new data types of course we need a repair step. - Evaluate an abstract subclass of
RowCellSupper
providing support for setting value type (e.g. addingsetValueTypeWrapper()
) or maybe it is sufficient (though not cleaner) to extend the current class, taking the existence of a value_type from the concrete implementation into account.
3.In the same way evaluate extendingRowCellMapperSuper
withparseValueTypeOutgoing()
andparseValueTypeIncoming()
although this is unlikely to contain "weird" data. We shall store there constants only (ideally only ints) and it should not be set by direct user input. Row2Mapper
needs to become aware of possiblevalue_type
fields, for example ininsert()
,getFilterExpression()
(there we already have type-dependent handling) and generally where at leastformatValue()
is being used- Insert ability to merge rows in
oc_tables_row_cells_xyz
that share the same column_id and row_id to be able to support multi-values by row. The difficulty lies in having different cell ids per actually set value, so this makes editing a cell difficult, but on a first glance the frontend does not work with cell IDs when updating a value.RowCellMapperSuper::findByRowAndColumn()
returns a single entity – a starting point would be to have a generic extension for multiple values with a method lilefindMultipleByRowAndColumn()
that can return multiple entities which will later on be merged for the frontend. - Where applicable frontend also has to supply value_type information, e.g. when submitting such cell values.
- Not looked into it yet by me: frontend live filtering, might not be an issue.
A non-generic solutions also ticks almost all items, albeit on concrete implemenations. The value_type might come in handy with other future types (could imagine it for columns like file or image picker, ip address, icon/emoji picker).
On a second look, i just saw the TextLinkBusiness
thing and it stores already up to three data points in its value (title
, value
, providerId
). If we want to be able to serve scenarios like these, we'd need to look into a more flexible approach.
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.
From what I see, with this approach, we can't perform real updates because we have multiple rows? All we can do is delete and insert?
0be010b
to
654df3a
Compare
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
e51cca5
to
924dbb7
Compare
Contributes to #586
This adds to the backend to support adding a new column that receives users or groups.
We expect the row values of this column to be array of objects with format
{id: string, isUser: boolean, displayName: string}
Creating a column
Request
Result