diff --git a/dictation_client/src/api/api.ts b/dictation_client/src/api/api.ts index 7e24f19..dcd3d1d 100644 --- a/dictation_client/src/api/api.ts +++ b/dictation_client/src/api/api.ts @@ -1232,6 +1232,12 @@ export interface TypistGroup { * @interface User */ export interface User { + /** + * + * @type {number} + * @memberof User + */ + 'id': number; /** * * @type {string} diff --git a/dictation_client/src/features/user/selectors.ts b/dictation_client/src/features/user/selectors.ts index 61c5e56..6f2029a 100644 --- a/dictation_client/src/features/user/selectors.ts +++ b/dictation_client/src/features/user/selectors.ts @@ -59,11 +59,11 @@ export const selectUserViews = (state: RootState): UserView[] => { const { users } = state.user.domain; const userViews = users.map((user): UserView => { const { - typistGroupName, - prompt, - encryption, - authorId, role, + authorId, + encryption, + prompt, + typistGroupName, licenseStatus, expiration, remaining, @@ -81,6 +81,7 @@ export const selectUserViews = (state: RootState): UserView[] => { prompt, typistGroupName ); + // restのid以外をUserViewに追加する return { typistGroupName: convertedValues.typistGroupName, prompt: convertedValues.prompt, diff --git a/dictation_client/src/features/user/state.ts b/dictation_client/src/features/user/state.ts index 00dac8e..1a0933a 100644 --- a/dictation_client/src/features/user/state.ts +++ b/dictation_client/src/features/user/state.ts @@ -14,6 +14,6 @@ export interface Apps { isLoading: boolean; } -export interface AddUser extends User { +export interface AddUser extends Omit { typistGroupId?: number | undefined; } diff --git a/dictation_server/src/api/odms/openapi.json b/dictation_server/src/api/odms/openapi.json index 9e50827..6aa43e8 100644 --- a/dictation_server/src/api/odms/openapi.json +++ b/dictation_server/src/api/odms/openapi.json @@ -2064,6 +2064,7 @@ "User": { "type": "object", "properties": { + "id": { "type": "number" }, "name": { "type": "string" }, "role": { "type": "string", "description": "none/author/typist" }, "authorId": { "type": "string" }, @@ -2083,6 +2084,7 @@ } }, "required": [ + "id", "name", "role", "typistGroupName", diff --git a/dictation_server/src/features/users/types/types.ts b/dictation_server/src/features/users/types/types.ts index 308cc26..cee0495 100644 --- a/dictation_server/src/features/users/types/types.ts +++ b/dictation_server/src/features/users/types/types.ts @@ -14,6 +14,9 @@ export class ConfirmRequest { export class ConfirmResponse {} export class User { + @ApiProperty() + id: number; + @ApiProperty() name: string; diff --git a/dictation_server/src/features/users/users.service.spec.ts b/dictation_server/src/features/users/users.service.spec.ts index 7d01d17..66b7e45 100644 --- a/dictation_server/src/features/users/users.service.spec.ts +++ b/dictation_server/src/features/users/users.service.spec.ts @@ -594,16 +594,17 @@ describe('UsersService.getUsers', () => { const module = await makeTestingModuleWithAdb2c(source, adb2cParam); const { accountId } = await createAccount(source); - const { externalId: externalId_author } = await createUser( - source, - accountId, - 'external_id1', - 'author', - 'AUTHOR_ID', - true, - ); + const { externalId: externalId_author, userId: authorUserId } = + await createUser( + source, + accountId, + 'external_id1', + 'author', + 'AUTHOR_ID', + true, + ); - const { userId: typistUser } = await createUser( + const { userId: typistUserId } = await createUser( source, accountId, 'external_id2', @@ -612,9 +613,9 @@ describe('UsersService.getUsers', () => { true, ); - await createUserGroup(source, accountId, 'group1', [typistUser]); + await createUserGroup(source, accountId, 'group1', [typistUserId]); - await createUser( + const { userId: noneUserId } = await createUser( source, accountId, 'external_id3', @@ -627,6 +628,7 @@ describe('UsersService.getUsers', () => { const expectedUsers = [ { + id: authorUserId, name: 'test1', role: 'author', authorId: 'AUTHOR_ID', @@ -643,6 +645,7 @@ describe('UsersService.getUsers', () => { licenseStatus: USER_LICENSE_STATUS.NO_LICENSE, }, { + id: typistUserId, name: 'test2', role: 'typist', authorId: undefined, @@ -659,6 +662,7 @@ describe('UsersService.getUsers', () => { licenseStatus: USER_LICENSE_STATUS.NO_LICENSE, }, { + id: noneUserId, name: 'test3', role: 'none', authorId: undefined, @@ -723,6 +727,7 @@ describe('UsersService.getUsers', () => { const expectedUsers = [ { + id: user1, name: 'test1', role: 'author', authorId: 'AUTHOR_ID1', @@ -741,6 +746,7 @@ describe('UsersService.getUsers', () => { licenseStatus: USER_LICENSE_STATUS.NORMAL, }, { + id: user2, name: 'test2', role: 'author', authorId: 'AUTHOR_ID2', @@ -759,6 +765,7 @@ describe('UsersService.getUsers', () => { licenseStatus: USER_LICENSE_STATUS.RENEW, }, { + id: user3, name: 'test3', role: 'author', authorId: 'AUTHOR_ID3', diff --git a/dictation_server/src/features/users/users.service.ts b/dictation_server/src/features/users/users.service.ts index 6e23f4c..6dcbeee 100644 --- a/dictation_server/src/features/users/users.service.ts +++ b/dictation_server/src/features/users/users.service.ts @@ -358,6 +358,7 @@ export class UsersService { } return { + id: x.id, name: adb2cUser.displayName, role: x.role, authorId: x.author_id ?? undefined,