Merge branch 'develop' into ccb

# Conflicts:
#	dictation_client/src/pages/UserListPage/index.tsx
This commit is contained in:
SAITO-PC-3\saito.k 2024-02-14 11:33:11 +09:00
commit 3877a4670d
12 changed files with 405 additions and 284 deletions

View File

@ -353,6 +353,7 @@ export const DisPlayInfo: React.FC = (): JSX.Element => {
<li> <li>
<label htmlFor="comment"> <label htmlFor="comment">
<input <input
id="comment"
type="checkbox" type="checkbox"
value="clm16" value="clm16"
className={styles.formCheck} className={styles.formCheck}

View File

@ -1166,13 +1166,7 @@ const DictationPage: React.FC = (): JSX.Element => {
{(isChangeTranscriptionistPopupOpen || !isLoading) && {(isChangeTranscriptionistPopupOpen || !isLoading) &&
tasks.length !== 0 && tasks.length !== 0 &&
tasks.map((x) => ( tasks.map((x) => (
<tr <tr key={x.audioFileId}>
key={x.audioFileId}
style={{
backgroundColor:
x.priority === "01" ? "#ff00004f" : "#ffffff",
}}
>
<td className={styles.clm0}> <td className={styles.clm0}>
<ul className={styles.menuInTable}> <ul className={styles.menuInTable}>
<li> <li>
@ -1288,7 +1282,12 @@ const DictationPage: React.FC = (): JSX.Element => {
</td> </td>
)} )}
{displayColumn.Priority && ( {displayColumn.Priority && (
<td className={styles.clm3}> <td
className={styles.clm3}
style={{
color: x.priority === "01" ? "red" : undefined,
}}
>
{x.priority === "01" {x.priority === "01"
? PRIORITY.HIGH ? PRIORITY.HIGH
: PRIORITY.NORMAL} : PRIORITY.NORMAL}

View File

@ -171,8 +171,11 @@ export const LicenseOrderHistory: React.FC<LicenseOrderHistoryProps> = (
<div> <div>
<div className={styles.pageHeader}> <div className={styles.pageHeader}>
<h1 className={styles.pageTitle}> <h1 className={styles.pageTitle}>
{t(getTranslationID("orderHistoriesPage.label.title"))} {t(getTranslationID("LicenseSummaryPage.label.title"))}
</h1> </h1>
<p className={styles.pageTx}>
{t(getTranslationID("orderHistoriesPage.label.orderHistory"))}
</p>
</div> </div>
<section className={styles.license}> <section className={styles.license}>
<div> <div>

View File

@ -166,168 +166,180 @@ const UserListPage: React.FC = (): JSX.Element => {
</a> </a>
</li> </li>
</ul> </ul>
<table className={`${styles.table} ${styles.user}`}> <div className={styles.tableWrap}>
<tbody> <table className={`${styles.table} ${styles.user}`}>
<tr className={styles.tableHeader}> <tbody>
<th className={styles.clm0}>{/** th is empty */}</th> <tr className={styles.tableHeader}>
<th>{t(getTranslationID("userListPage.label.name"))}</th> <th className={styles.clm0}>{/** th is empty */}</th>
<th>{t(getTranslationID("userListPage.label.role"))}</th> <th>
<th> {t(getTranslationID("userListPage.label.name"))}
{t(getTranslationID("userListPage.label.authorID"))} </th>
</th> <th>
<th> {t(getTranslationID("userListPage.label.role"))}
{t(getTranslationID("userListPage.label.encryption"))} </th>
</th> <th>
<th> {t(getTranslationID("userListPage.label.authorID"))}
{t(getTranslationID("userListPage.label.prompt"))} </th>
</th> <th>
<th> {t(getTranslationID("userListPage.label.encryption"))}
{t(getTranslationID("userListPage.label.typistGroup"))} </th>
</th> <th>
<th>{t(getTranslationID("userListPage.label.email"))}</th> {t(getTranslationID("userListPage.label.prompt"))}
<th> </th>
{t(getTranslationID("userListPage.label.status"))} <th>
</th> {t(
<th> getTranslationID("userListPage.label.typistGroup")
{t(getTranslationID("userListPage.label.expiration"))} )}
</th> </th>
<th> <th>
{t(getTranslationID("userListPage.label.remaining"))} {t(getTranslationID("userListPage.label.email"))}
</th> </th>
<th> <th>
{t(getTranslationID("userListPage.label.autoRenew"))} {t(getTranslationID("userListPage.label.status"))}
</th> </th>
<th> <th>
{t(getTranslationID("userListPage.label.notification"))} {t(getTranslationID("userListPage.label.expiration"))}
</th> </th>
<th> <th>
{t( {t(getTranslationID("userListPage.label.remaining"))}
getTranslationID("userListPage.label.emailVerified") </th>
)} <th>
</th> {t(getTranslationID("userListPage.label.autoRenew"))}
</tr> </th>
{!isLoading && <th>
users.map((user) => ( {t(
<tr key={user.email}> getTranslationID("userListPage.label.notification")
<td className={styles.clm0}> )}
<ul className={styles.menuInTable}> </th>
<li> <th>
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} {t(
<a getTranslationID("userListPage.label.emailVerified")
onClick={() => { )}
onUpdateOpen(user.id); </th>
}} </tr>
> {!isLoading &&
{t( users.map((user) => (
getTranslationID( <tr key={user.email}>
"userListPage.label.editUser" <td className={styles.clm0}>
) <ul className={styles.menuInTable}>
)} <li>
</a> {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
</li> <a
{isTier5 && ( onClick={() => {
<> onUpdateOpen(user.id);
<li> }}
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} >
<a {t(
onClick={() => { getTranslationID(
onAllocateLicensePopupOpen(user); "userListPage.label.editUser"
}} )
> )}
{t( </a>
getTranslationID( </li>
"userListPage.label.licenseAllocation" {isTier5 && (
) <>
)} <li>
</a> {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
</li> <a
<li> onClick={() => {
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} onAllocateLicensePopupOpen(user);
<a }}
className={ >
user.licenseStatus === {t(
LICENSE_STATUS.NOLICENSE getTranslationID(
? styles.isDisable "userListPage.label.licenseAllocation"
: "" )
} )}
onClick={() => { </a>
onLicenseDeallocation(user.id); </li>
}} <li>
> {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
{t( <a
getTranslationID( className={
"userListPage.label.licenseDeallocation" user.licenseStatus ===
) LICENSE_STATUS.NOLICENSE
)} ? styles.isDisable
</a> : ""
</li> }
</> onClick={() => {
)} onLicenseDeallocation(user.id);
<li> }}
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} >
<a {t(
onClick={() => { getTranslationID(
onDeleteUser(user.id); "userListPage.label.licenseDeallocation"
}} )
> )}
{t( </a>
getTranslationID( </li>
"userListPage.label.deleteUser" </>
) )}
)} <li>
</a> {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
</li> <a
</ul> onClick={() => {
</td> onDeleteUser(user.id);
<td> {user.name}</td> }}
<td>{user.role}</td> >
<td>{user.authorId}</td> {t(
<td>{boolToElement(user.encryption)}</td> getTranslationID(
<td>{boolToElement(user.prompt)}</td> "userListPage.label.deleteUser"
<td>{arrayToElement(user.typistGroupName)}</td> )
<td>{user.email}</td> )}
<td> </a>
<span </li>
className={ </ul>
user.licenseStatus === </td>
LICENSE_STATUS.NOLICENSE || <td> {user.name}</td>
user.licenseStatus === LICENSE_STATUS.ALERT <td>{user.role}</td>
? styles.isAlert <td>{user.authorId}</td>
: "" <td>{boolToElement(user.encryption)}</td>
} <td>{boolToElement(user.prompt)}</td>
> <td>{arrayToElement(user.typistGroupName)}</td>
{getLicenseStatus(user.licenseStatus)} <td>{user.email}</td>
</span> <td>
</td> <span
<td> className={
<span user.licenseStatus ===
className={ LICENSE_STATUS.NOLICENSE ||
user.licenseStatus === LICENSE_STATUS.ALERT user.licenseStatus === LICENSE_STATUS.ALERT
? styles.isAlert ? styles.isAlert
: "" : ""
} }
> >
{user.expiration ?? "-"} {getLicenseStatus(user.licenseStatus)}
</span> </span>
</td> </td>
<td> <td>
<span <span
className={ className={
user.licenseStatus === LICENSE_STATUS.ALERT user.licenseStatus === LICENSE_STATUS.ALERT
? styles.isAlert ? styles.isAlert
: "" : ""
} }
> >
{user.remaining ?? "-"} {user.expiration ?? "-"}
</span> </span>
</td> </td>
<td>{boolToElement(user.autoRenew)}</td> <td>
<td>{boolToElement(user.notification)}</td> <span
<td>{boolToElement(user.emailVerified)}</td> className={
</tr> user.licenseStatus === LICENSE_STATUS.ALERT
))} ? styles.isAlert
</tbody> : ""
</table> }
>
{user.remaining ?? "-"}
</span>
</td>
<td>{boolToElement(user.autoRenew)}</td>
<td>{boolToElement(user.notification)}</td>
<td>{boolToElement(user.emailVerified)}</td>
</tr>
))}
</tbody>
</table>
</div>
{!isLoading && users.length === 0 && ( {!isLoading && users.length === 0 && (
<p <p
style={{ style={{

View File

@ -128,107 +128,132 @@ export const EditOptionItemsPopup: React.FC<EditOptionItemsPopupProps> = (
<dl className={`${styles.formList} ${styles.hasbg}`}> <dl className={`${styles.formList} ${styles.hasbg}`}>
<dd className={styles.full}> <dd className={styles.full}>
<div className={styles.tableWrap}> <div className={styles.tableWrap}>
<table className={styles.table}> <table className={`${styles.table} ${styles.optionItem}`}>
<tr className={styles.tableHeader}> <tbody>
<th className={styles.noLine}> <tr className={styles.tableHeader}>
{t(getTranslationID("worktypeIdSetting.label.itemLabel"))} <th className={styles.noLine}>
</th> {t(
<th className={styles.noLine}> getTranslationID("worktypeIdSetting.label.itemLabel")
{t( )}
getTranslationID("worktypeIdSetting.label.defaultValue") </th>
)} <th className={styles.noLine}>
</th> {t(
<th> getTranslationID(
{t( "worktypeIdSetting.label.defaultValue"
getTranslationID("worktypeIdSetting.label.initialValue") )
)} )}
</th> </th>
</tr> <th>
{optionItems?.map((item) => ( {t(
<tr key={`optionItem_${item.id}`}> getTranslationID(
<td> "worktypeIdSetting.label.initialValue"
<input )
type="text" )}
maxLength={16} </th>
name="itemLabel" </tr>
value={item.itemLabel} {optionItems?.map((item) => (
className={styles.formInput} <tr key={`optionItem_${item.id}`}>
onChange={(e) => { <td>
const { value } = e.target;
// optionItemsの更新
const newOptionItem = {
...item,
itemLabel: value,
};
onChangeOptionItem(newOptionItem);
}}
/>
</td>
<td>
<select
name="defaultValueType"
className={styles.formInput}
value={item.defaultValueType}
onChange={(e) => {
const { value } = e.target;
// optionItemsの更新
const newOptionItem = {
...item,
defaultValueType: value,
};
onChangeOptionItem(newOptionItem);
}}
>
<option
value={OPTION_ITEMS_DEFAULT_VALUE_TYPE.DEFAULT}
>
{t(
getTranslationID(
"worktypeIdSetting.label.default"
)
)}
</option>
<option value={OPTION_ITEMS_DEFAULT_VALUE_TYPE.BLANK}>
{t(
getTranslationID("worktypeIdSetting.label.blank")
)}
</option>
<option
value={OPTION_ITEMS_DEFAULT_VALUE_TYPE.LAST_INPUT}
>
{t(
getTranslationID(
"worktypeIdSetting.label.lastInput"
)
)}
</option>
</select>
</td>
<td>
{item.defaultValueType ===
OPTION_ITEMS_DEFAULT_VALUE_TYPE.DEFAULT ? (
<input <input
type="text" type="text"
maxLength={20} maxLength={16}
name="initialValue" name="itemLabel"
value={item.initialValue} value={item.itemLabel}
className={styles.formInput} className={styles.formInput}
onChange={(e) => { onChange={(e) => {
const { value } = e.target; const { value } = e.target;
// optionItemsの更新 // optionItemsの更新
const newOptionItem = { const newOptionItem = {
...item, ...item,
initialValue: value, itemLabel: value,
}; };
onChangeOptionItem(newOptionItem); onChangeOptionItem(newOptionItem);
}} }}
/> />
) : ( </td>
"-" <td>
)} <select
name="defaultValueType"
className={styles.formInput}
value={item.defaultValueType}
onChange={(e) => {
const { value } = e.target;
// optionItemsの更新
const newOptionItem = {
...item,
defaultValueType: value,
};
onChangeOptionItem(newOptionItem);
}}
>
<option
value={OPTION_ITEMS_DEFAULT_VALUE_TYPE.DEFAULT}
>
{t(
getTranslationID(
"worktypeIdSetting.label.default"
)
)}
</option>
<option
value={OPTION_ITEMS_DEFAULT_VALUE_TYPE.BLANK}
>
{t(
getTranslationID(
"worktypeIdSetting.label.blank"
)
)}
</option>
<option
value={OPTION_ITEMS_DEFAULT_VALUE_TYPE.LAST_INPUT}
>
{t(
getTranslationID(
"worktypeIdSetting.label.lastInput"
)
)}
</option>
</select>
</td>
<td>
{item.defaultValueType ===
OPTION_ITEMS_DEFAULT_VALUE_TYPE.DEFAULT ? (
<input
type="text"
maxLength={20}
name="initialValue"
value={item.initialValue}
className={styles.formInput}
onChange={(e) => {
const { value } = e.target;
// optionItemsの更新
const newOptionItem = {
...item,
initialValue: value,
};
onChangeOptionItem(newOptionItem);
}}
/>
) : (
"-"
)}
</td>
</tr>
))}
<tr>
<td colSpan={3}>
<span
className={`${styles.formComment} ${styles.alignCenter}`}
>
{t(
getTranslationID(
"worktypeIdSetting.label.optionItemTerms"
)
)}
</span>
</td> </td>
</tr> </tr>
))} </tbody>
</table> </table>
{isPushSaveButton && hasInvalidOptionItems && ( {isPushSaveButton && hasInvalidOptionItems && (
<span className={`${styles.formError} ${styles.alignCenter}`}> <span className={`${styles.formError} ${styles.alignCenter}`}>
@ -248,14 +273,6 @@ export const EditOptionItemsPopup: React.FC<EditOptionItemsPopupProps> = (
)} )}
</span> </span>
)} )}
<span
style={{ display: "block" }}
className={`${styles.formComment} ${styles.alignCenter}`}
>
{t(
getTranslationID("worktypeIdSetting.label.optionItemTerms")
)}
</span>
</div> </div>
</dd> </dd>
<dd className={`${styles.full} ${styles.alignCenter}`}> <dd className={`${styles.full} ${styles.alignCenter}`}>

View File

@ -1130,6 +1130,9 @@ h3 + .brCrumb .tlIcon {
.modal .form .table.backup td:first-child { .modal .form .table.backup td:first-child {
padding: 0.6rem 0.2rem; padding: 0.6rem 0.2rem;
} }
.modal .form .table.optionItem select {
width: 123px;
}
.modal .form .pagenation { .modal .form .pagenation {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
padding-right: 2.5%; padding-right: 2.5%;
@ -1597,15 +1600,6 @@ _:-ms-lang(x)::-ms-backdrop,
left: 0; left: 0;
z-index: 2; z-index: 2;
} }
.account .table.user,
.user .table.user,
.license .table.user,
.dictation .table.user,
.partners .table.user,
.workflow .table.user,
.support .table.user {
margin-bottom: 5rem;
}
.account .table.user th::after, .account .table.user th::after,
.user .table.user th::after, .user .table.user th::after,
.license .table.user th::after, .license .table.user th::after,
@ -1626,6 +1620,16 @@ _:-ms-lang(x)::-ms-backdrop,
vertical-align: top; vertical-align: top;
} }
.user .table {
margin-bottom: 0;
}
.user .tableWrap {
max-width: calc(100vw - 5.1rem);
max-height: 90vh;
overflow-x: scroll;
margin-bottom: 5rem;
}
.account .listVertical { .account .listVertical {
margin-bottom: 3rem; margin-bottom: 3rem;
} }
@ -2488,10 +2492,13 @@ tr.isSelected .menuInTable li a.isDisable {
.formChange ul.chooseMember li input + label, .formChange ul.chooseMember li input + label,
.formChange ul.holdMember li input + label { .formChange ul.holdMember li input + label {
display: block; display: block;
padding: 0.2rem 0 0.2rem 1.5rem; padding: 0.4rem 0 0.4rem 1.5rem;
margin-right: 0; margin-right: 0;
background: url(../assets/images/circle.svg) no-repeat left center; background: url(../assets/images/circle.svg) no-repeat left center;
background-size: 1.3rem; background-size: 1.3rem;
white-space: pre-line;
word-break: break-all;
line-height: 1.3;
} }
.formChange ul.chooseMember li input + label:hover, .formChange ul.chooseMember li input + label:hover,
.formChange ul.holdMember li input + label:hover { .formChange ul.holdMember li input + label:hover {
@ -2501,7 +2508,7 @@ tr.isSelected .menuInTable li a.isDisable {
} }
.formChange ul.chooseMember li input:checked + label, .formChange ul.chooseMember li input:checked + label,
.formChange ul.holdMember li input:checked + label { .formChange ul.holdMember li input:checked + label {
padding: 0.2rem 1rem 0.2rem 0; padding: 0.4rem 1.5rem 0.4rem 0;
background: url(../assets/images/check_circle_fill.svg) no-repeat right center; background: url(../assets/images/check_circle_fill.svg) no-repeat right center;
background-size: 1.3rem; background-size: 1.3rem;
} }

View File

@ -74,6 +74,7 @@ declare const classNames: {
readonly table: "table"; readonly table: "table";
readonly tableHeader: "tableHeader"; readonly tableHeader: "tableHeader";
readonly backup: "backup"; readonly backup: "backup";
readonly optionItem: "optionItem";
readonly pagenation: "pagenation"; readonly pagenation: "pagenation";
readonly encryptionPass: "encryptionPass"; readonly encryptionPass: "encryptionPass";
readonly pageHeader: "pageHeader"; readonly pageHeader: "pageHeader";

View File

@ -18,14 +18,21 @@ import {
} from './test/utility'; } from './test/utility';
import { UsersService } from '../users/users.service'; import { UsersService } from '../users/users.service';
import { Context, makeContext } from '../../common/log'; import { Context, makeContext } from '../../common/log';
import { ADB2C_SIGN_IN_TYPE, LICENSE_ALLOCATED_STATUS, LICENSE_TYPE } from '../../constants'; import {
ADB2C_SIGN_IN_TYPE,
LICENSE_ALLOCATED_STATUS,
LICENSE_TYPE,
} from '../../constants';
import { import {
makeHierarchicalAccounts, makeHierarchicalAccounts,
makeTestSimpleAccount, makeTestSimpleAccount,
makeTestUser, makeTestUser,
} from '../../common/test/utility'; } from '../../common/test/utility';
import { LicensesRepositoryService } from '../../repositories/licenses/licenses.repository.service'; import { LicensesRepositoryService } from '../../repositories/licenses/licenses.repository.service';
import { overrideAdB2cService, overrideSendgridService } from '../../common/test/overrides'; import {
overrideAdB2cService,
overrideSendgridService,
} from '../../common/test/overrides';
import { truncateAllTable } from '../../common/test/init'; import { truncateAllTable } from '../../common/test/init';
describe('ライセンス注文', () => { describe('ライセンス注文', () => {
@ -672,7 +679,10 @@ describe('ライセンス割り当て', () => {
const module = await makeTestingModule(source); const module = await makeTestingModule(source);
if (!module) fail(); if (!module) fail();
const { id: dealerId } = await makeTestSimpleAccount(source, { company_name: "DEALER_COMPANY", tier: 4 }); const { id: dealerId } = await makeTestSimpleAccount(source, {
company_name: 'DEALER_COMPANY',
tier: 4,
});
const { id: dealerAdminId } = await makeTestUser(source, { const { id: dealerAdminId } = await makeTestUser(source, {
account_id: dealerId, account_id: dealerId,
external_id: 'userId_admin', external_id: 'userId_admin',
@ -682,7 +692,7 @@ describe('ライセンス割り当て', () => {
const { id: accountId } = await makeTestSimpleAccount(source, { const { id: accountId } = await makeTestSimpleAccount(source, {
parent_account_id: dealerId, parent_account_id: dealerId,
tier: 5 tier: 5,
}); });
const { id: userId } = await makeTestUser(source, { const { id: userId } = await makeTestUser(source, {
account_id: accountId, account_id: accountId,
@ -740,7 +750,7 @@ describe('ライセンス割り当て', () => {
}, },
], ],
})); }));
} },
}); });
overrideSendgridService(service, { overrideSendgridService(service, {

View File

@ -11,6 +11,7 @@ import { makeErrorResponse } from '../../common/error/makeErrorResponse';
import { TasksService } from './tasks.service'; import { TasksService } from './tasks.service';
import { DataSource } from 'typeorm'; import { DataSource } from 'typeorm';
import { import {
createAudioFile,
createCheckoutPermissions, createCheckoutPermissions,
createTask, createTask,
createUserGroup, createUserGroup,
@ -707,6 +708,19 @@ describe('TasksService', () => {
role: 'author', role: 'author',
author_id: 'MY_AUTHOR_ID', author_id: 'MY_AUTHOR_ID',
}); });
//「バグ 3661: [FB対応]Option Itemにチェックを付けると真っ白な画面になる」の確認のため
// audio_file_idをTaskIdと異なる値にするために、AudioFileを作成
await createAudioFile(
source,
accountId,
userId,
'MY_AUTHOR_ID',
'',
'00',
);
// Taskを作成
await createTask( await createTask(
source, source,
accountId, accountId,
@ -750,10 +764,26 @@ describe('TasksService', () => {
{ {
const task = tasks[0]; const task = tasks[0];
expect(task.jobNumber).toEqual('00000001'); expect(task.jobNumber).toEqual('00000001');
// AudioOptionItem
const audioOptionItems = Array.from({ length: 10 }).map((_, i) => {
return {
optionItemLabel: `label${i}:audio_file_id${task.audioFileId}`,
optionItemValue: `value${i}:audio_file_id${task.audioFileId}`,
};
});
expect(task.optionItemList).toEqual(audioOptionItems);
} }
{ {
const task = tasks[1]; const task = tasks[1];
expect(task.jobNumber).toEqual('00000002'); expect(task.jobNumber).toEqual('00000002');
// AudioOptionItem
const audioOptionItems = Array.from({ length: 10 }).map((_, i) => {
return {
optionItemLabel: `label${i}:audio_file_id${task.audioFileId}`,
optionItemValue: `value${i}:audio_file_id${task.audioFileId}`,
};
});
expect(task.optionItemList).toEqual(audioOptionItems);
} }
}); });
it('[Author] Authorは同一アカウントであっても自分以外のAuhtorのTaskは取得できない', async () => { it('[Author] Authorは同一アカウントであっても自分以外のAuhtorのTaskは取得できない', async () => {

View File

@ -131,6 +131,17 @@ export const createTask = async (
audio_format: 'audio_format', audio_format: 'audio_format',
is_encrypted: true, is_encrypted: true,
}); });
// AudioOptionItemを10個作成
const audioOptionItems = Array.from({ length: 10 }).map((_, i) => {
return {
audio_file_id: audioFileIdentifiers[0].id,
label: `label${i}:audio_file_id${audioFileIdentifiers[0].id}`,
value: `value${i}:audio_file_id${audioFileIdentifiers[0].id}`,
};
});
await datasource.getRepository(AudioOptionItem).insert(audioOptionItems);
const audioFile = audioFileIdentifiers.pop() as AudioFile; const audioFile = audioFileIdentifiers.pop() as AudioFile;
const { identifiers: taskIdentifiers } = await datasource const { identifiers: taskIdentifiers } = await datasource
.getRepository(Task) .getRepository(Task)
@ -202,6 +213,37 @@ export const createTask = async (
return { taskId: task.id, audioFileId: audioFile.id }; return { taskId: task.id, audioFileId: audioFile.id };
}; };
export const createAudioFile = async (
datasource: DataSource,
account_id: number,
owner_user_id: number,
author_id: string,
work_type_id: string,
priority: string,
): Promise<{ audioFileId: number }> => {
const { identifiers: audioFileIdentifiers } = await datasource
.getRepository(AudioFile)
.insert({
account_id: account_id,
owner_user_id: owner_user_id,
url: '',
file_name: 'x.zip',
author_id: author_id,
work_type_id: work_type_id,
started_at: new Date(),
duration: '100000',
finished_at: new Date(),
uploaded_at: new Date(),
file_size: 10000,
priority: priority,
audio_format: 'audio_format',
is_encrypted: true,
});
const audioFile = audioFileIdentifiers.pop() as AudioFile;
return { audioFileId: audioFile.id };
};
/** /**
* *
* @param datasource * @param datasource

View File

@ -17,7 +17,6 @@ export class GetTemplatesResponse {
templates: TemplateFile[]; templates: TemplateFile[];
} }
export class DeleteTemplateRequestParam { export class DeleteTemplateRequestParam {
@ApiProperty() @ApiProperty()
@Type(() => Number) @Type(() => Number)

View File

@ -18,6 +18,6 @@ export class AudioOptionItem {
@Column() @Column()
value: string; value: string;
@ManyToOne(() => Task, (task) => task.audio_file_id) @ManyToOne(() => Task, (task) => task.audio_file_id)
@JoinColumn({ name: 'audio_file_id' }) @JoinColumn({ name: 'audio_file_id', referencedColumnName: 'audio_file_id' })
task: Task | null; task: Task | null;
} }