enso/app
Nikita Pekin 6d73dadcee
impr(enso/cloud-v2#912): Add organization_id and user_id fields to SimpleUser (#9508)
- Updates the model types for the request/response bodies to match the backend.
  - Renames `CreatePermissionRequestBody::userSubjects` to match `CreatePermissionRequestBody::actorsIds` on the backend
  - Renames `UserInfo::organization_id` to camel case
  - Adds `UserInfo::userId` field to match the backend
  - Merges `SimpleUser` into `UserInfo`

Previously, `UserInfo`'s `OrganizationId` was serialized as `pk`. This
is not desired since `pk` is an implementation detail (relating to
DynamoDB). This commit renames the field to accurately reflect the type
of data it contains.

- Renames `User::id` to `User::organizationId`.

Previously, the user's organization ID was under the `id` field. As of
enso-cloud/cloud-v2#1098, this is no longer the case. The
`organizationId` field is no longer a user's primary identifier --
`userId` should be used for that purpose instead. So this field has been
renamed to `organizationId` to more clearly describe the purpose of the
field.

Affects the responses expected from the following endpoints:

- `PUT /users/me/picture`
- `PUT /users/me`
- `GET /users/me`
- `PUT /users/{userId}/usergroups`

- Adds `User::userId` field.

Previously, the user's organization ID was used to uniquely identify a
user. Now that multiple users can be invited to an organization, it is
no longer appropriate to use organization ID to uniquely refer to a
user. For this purpose, the backend has introduced the `userId` field.

Affects the responses expected from the following endpoints:

- `POST /users`
- `PUT  /users/me/picture`
- `PUT  /users/me`
- `GET  /users/me`
- `PUT  /users/{userId}/usergroups`

Removes the `user` param from `tryGetSingletonOwnerPermission`. This
param was previously required. It was required because a `userSubject`
was necessary to optimistically generate a `UserPermission`. With recent
refactors, a `userId` can be used in place of `userSubject` to generate
a `UserPermission`. The existing param `owner` provides the `userId`, so
the `user` param is redundant and can be removed.

- Removes `UserInfo` from the `FullUserSession`.

Previously, `UserInfo` in the `FullUserSession` was required to obtain a
`userSubject`. Now, `userSubject` has been deprecated in favour of
`userId`. `User` provides `userId`, and is present in the
`FullUserSession`. Thus, this commit removes `UserInfo` from the
`FullUserSession` since it is redundant.

- Renames `UserInfo` fields to `camelCase`

Previously, `UserInfo`'s fields were serialized as `snake_case`. This is
not desired since the convention for the frontend is to use `camelCase`
for field names where possible. This commit renames the fields to be
`camelCase`, now that the backend has been updated accordingly.

- Sorts by `userId` rather than `email`
- Compares by `userId` rather than `email`

- Extends `User` from `UserInfo`

After refactoring, `UserInfo` is now a subset of `User`. To remove
duplication, this commit modifies `User` to extend `UserInfo`.
2024-03-27 15:58:08 +01:00
..
gui2 Directory management on Local (Project Manager) backend (#9353) 2024-03-27 14:42:23 +00:00
ide-desktop impr(enso/cloud-v2#912): Add organization_id and user_id fields to SimpleUser (#9508) 2024-03-27 15:58:08 +01:00