Merged PR 298: ユーザー一覧修正(API・画面)

## 概要
[Task2318: ユーザー追加・一覧修正(API・画面)](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2318)

- API
  - ユーザー一覧取得APIのレスポンスにUserIDを追加
  - OpenAPI生成

- 画面
  - コード自動生成
  - storeにidを含めたユーザー一覧情報を格納する

## レビューポイント
- 修正内容に認識違いはないか

## UIの変更
- Before/Afterのスクショなど
- スクショ置き場

## 動作確認状況
- ローカルで確認

## 補足
- ユーザー追加については別タスクで対応
This commit is contained in:
saito.k 2023-08-03 00:51:03 +00:00
parent f1684a5616
commit 6a2d2eabde
7 changed files with 36 additions and 16 deletions

View File

@ -1232,6 +1232,12 @@ export interface TypistGroup {
* @interface User
*/
export interface User {
/**
*
* @type {number}
* @memberof User
*/
'id': number;
/**
*
* @type {string}

View File

@ -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,

View File

@ -14,6 +14,6 @@ export interface Apps {
isLoading: boolean;
}
export interface AddUser extends User {
export interface AddUser extends Omit<User, "id"> {
typistGroupId?: number | undefined;
}

View File

@ -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",

View File

@ -14,6 +14,9 @@ export class ConfirmRequest {
export class ConfirmResponse {}
export class User {
@ApiProperty()
id: number;
@ApiProperty()
name: string;

View File

@ -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',

View File

@ -358,6 +358,7 @@ export class UsersService {
}
return {
id: x.id,
name: adb2cUser.displayName,
role: x.role,
authorId: x.author_id ?? undefined,