Closed timcowlishaw closed 7 months ago
Hey @oscgonfer FYI I've added a commit to ensure that user tags and location are properly listed for devices on the user endpoint (this simplifies things too to just reuse the /devices representation as much as possible rather than using a completely different serialisation.
Much nicer, thank you for also reusing the device representation. This approach makes it cleaner and more maintainable. It makes me think of the health check (that we have in the list for the future) and how we can try to reuse devices to make more informative views in the different front-end views (i.e. if one day we add the health to the device, I'd like that to propagate to the different views of the devices adapted obviously to each context, without having to rewrite it all each time).
As far as this one, I'll try to test in staging once I have time and merge if all goes well.
Yeah, i think that might be something to put on a general 'tech debt' refactoring list for when we have the kits stuff shipped - try and settle on a 'default representation' in JSON for each model type and reuse it across all the endpoints - there's a lot of duplication in those jbuilder files!
In fact, I might create a tech debt issue now with a list.
On Fri, 1 Dec 2023 at 10:23, oscgonfer @.***> wrote:
Much nicer, thank you for also reusing the device representation. This approach makes it cleaner and more maintainable. It makes me think of the health check (that we have in the list for the future) and how we can try to reuse devices to make more informative views in the different front-end views (i.e. if one day we add the health to the device, I'd like that to propagate to the different views of the devices adapted obviously to each context, without having to rewrite it all each time).
As far as this one, I'll try to test in staging once I have time and merge if all goes well.
— Reply to this email directly, view it on GitHub https://github.com/fablabbcn/smartcitizen-api/pull/285#issuecomment-1835839544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABBNY4OU67YGKSWWSWE2LYHGV2VAVCNFSM6AAAAAA7Z3YCM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZVHAZTSNJUGQ . You are receiving this because you authored the thread.Message ID: @.***>
That sounds great! Thank you so much
@timcowlishaw
A minor detail... It seems there is also an (always null) owner
property added now to the devices on the /user
. I don't know if it can be removed, but I guess it's inherited (?) and could be potentially confusing? Otherwise, if you think it's unnecessary or too much of a hassle, I can merge.
aha good spot, thanks Oscar - that's now fixed!
If the current authenticated user is the user being requested, they are visible If the current authenticated user is an admin, they are visible If there is no current user, or the current user is a different citizen or researcher, they are not.