u
This commit is contained in:
@@ -18,7 +18,7 @@ export default function list(provider) {
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {object} [tx] - Optional transaction.
|
||||
* @returns {Promise<Array<{id: number, name: string, sort: number, exclusive: boolean, values: Array<{id: number, value: string, sort: number}>}>>}
|
||||
* @returns {Promise<Array<{id: number, name: string, sort: number, exclusive: boolean, articleCount: number, values: Array<{id: number, value: string, sort: number, articleCount: number}>}>>}
|
||||
*/
|
||||
return async (googleAuthId, tx) => {
|
||||
const { companyId } = await access(googleAuthId, tx);
|
||||
@@ -28,7 +28,13 @@ export default function list(provider) {
|
||||
name: row.name,
|
||||
sort: row.sort,
|
||||
exclusive: Boolean(row.exclusive),
|
||||
values: parseValues(row.valuesJson),
|
||||
articleCount: Number(row.articleCount ?? 0),
|
||||
values: parseValues(row.valuesJson).map((v) => ({
|
||||
id: v.id,
|
||||
value: v.value,
|
||||
sort: v.sort,
|
||||
articleCount: Number(v.articleCount ?? 0),
|
||||
})),
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function listByAttributeId(provider) {
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {number} attributeId - The attribute id.
|
||||
* @param {object} [tx] - Optional transaction.
|
||||
* @returns {Promise<Array<{id: number, attributeId: number, value: string, sort: number}>>}
|
||||
* @returns {Promise<Array<{id: number, attributeId: number, value: string, sort: number, articleCount: number}>>}
|
||||
*/
|
||||
return async (googleAuthId, attributeId, tx) => {
|
||||
if (!attributeId || !Number.isInteger(Number(attributeId))) {
|
||||
@@ -29,6 +29,7 @@ export default function listByAttributeId(provider) {
|
||||
attributeId: row.attributeId,
|
||||
value: row.value,
|
||||
sort: row.sort,
|
||||
articleCount: Number(row.articleCount ?? 0),
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function list(provider) {
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {object} [tx] - Optional transaction.
|
||||
* @returns {Promise<Array<{id: number, name: string, sort: number, exclusive: boolean}>>}
|
||||
* @returns {Promise<Array<{id: number, name: string, sort: number, exclusive: boolean, articleCount: number}>>}
|
||||
*/
|
||||
return async (googleAuthId, tx) => {
|
||||
const { companyId } = await access(googleAuthId, tx);
|
||||
@@ -22,6 +22,7 @@ export default function list(provider) {
|
||||
name: row.name,
|
||||
sort: row.sort,
|
||||
exclusive: Boolean(row.exclusive),
|
||||
articleCount: Number(row.articleCount ?? 0),
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user