1
0

fix(server): use TransformerInjectable in GetRefundCreditNoteTransaction

Refactor the GetRefundCreditNoteTransaction service to use TransformerInjectable
instead of directly injecting RefundCreditNoteTransformer, following the standard
NestJS DI pattern used throughout the codebase.

Also includes SDK TypeScript updates:
- Add new type exports for bank-rules operations
- Update organization SDK utilities with proper types
- Add accounts list filtering params to schema (customViewId, filterRoles, etc.)
- Remove export module from SDK index
- Sync openapi.json with latest API changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ahmed Bouhuolia
2026-03-09 21:42:06 +02:00
parent 48e41da345
commit 95ca4c21be
8 changed files with 132 additions and 130 deletions
@@ -1,16 +1,13 @@
import { Inject, Injectable } from '@nestjs/common';
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
import { RefundCreditNote } from '../models/RefundCreditNote';
import { RefundCreditNoteTransformer } from '../../CreditNotes/queries/RefundCreditNoteTransformer';
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
@Injectable()
export class GetRefundCreditNoteTransaction {
/**
* @param {RefundCreditNoteTransformer} transformer
* @param {typeof RefundCreditNote} refundCreditNoteModel
*/
constructor(
private readonly transformer: RefundCreditNoteTransformer,
private readonly transformer: TransformerInjectable,
@Inject(RefundCreditNote.name)
private readonly refundCreditNoteModel: TenantModelProxy<
@@ -33,6 +30,9 @@ export class GetRefundCreditNoteTransaction {
.withGraphFetched('creditNote')
.throwIfNotFound();
return this.transformer.transform(refundCreditNote);
return this.transformer.transform(
refundCreditNote,
new RefundCreditNoteTransformer(),
);
}
}
+98 -109
View File
@@ -2279,6 +2279,104 @@
],
"type": "string"
}
},
{
"name": "customViewId",
"required": false,
"in": "query",
"description": "Custom view ID",
"schema": {
"example": 1,
"type": "number"
}
},
{
"name": "filterRoles",
"required": false,
"in": "query",
"description": "Filter roles array",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "columnSortBy",
"required": false,
"in": "query",
"description": "Column to sort by",
"schema": {
"example": "created_at",
"type": "string"
}
},
{
"name": "sortOrder",
"required": false,
"in": "query",
"description": "Sort order",
"schema": {
"example": "DESC",
"enum": [
"DESC",
"ASC"
],
"type": "string"
}
},
{
"name": "stringifiedFilterRoles",
"required": false,
"in": "query",
"description": "Stringified filter roles",
"schema": {
"example": "{\"fieldKey\":\"root_type\",\"value\":\"asset\"}",
"type": "string"
}
},
{
"name": "searchKeyword",
"required": false,
"in": "query",
"description": "Search keyword",
"schema": {
"example": "bank account",
"type": "string"
}
},
{
"name": "viewSlug",
"required": false,
"in": "query",
"description": "View slug",
"schema": {
"example": "assets",
"type": "string"
}
},
{
"name": "page",
"required": false,
"in": "query",
"description": "Page number",
"schema": {
"minimum": 1,
"example": 1,
"type": "number"
}
},
{
"name": "pageSize",
"required": false,
"in": "query",
"description": "Page size",
"schema": {
"minimum": 1,
"example": 25,
"type": "number"
}
}
],
"responses": {
@@ -11536,115 +11634,6 @@
"example": false,
"type": "boolean"
}
},
{
"description": "Custom view ID",
"required": false,
"name": "customViewId",
"in": "query",
"schema": {
"example": 1,
"type": "number"
}
},
{
"description": "Filter roles array",
"required": false,
"name": "filterRoles",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "array"
}
}
},
{
"description": "Column to sort by",
"required": false,
"name": "columnSortBy",
"in": "query",
"schema": {
"example": "created_at",
"type": "string"
}
},
{
"description": "Sort order",
"required": false,
"name": "sortOrder",
"in": "query",
"schema": {
"example": "DESC",
"enum": [
"DESC",
"ASC"
],
"type": "string"
}
},
{
"description": "Stringified filter roles",
"required": false,
"name": "stringifiedFilterRoles",
"in": "query",
"schema": {
"example": "{\"fieldKey\":\"status\",\"value\":\"active\"}",
"type": "string"
}
},
{
"description": "Search keyword",
"required": false,
"name": "searchKeyword",
"in": "query",
"schema": {
"example": "bank account",
"type": "string"
}
},
{
"description": "View slug",
"required": false,
"name": "viewSlug",
"in": "query",
"schema": {
"example": "active-accounts",
"type": "string"
}
},
{
"description": "Page number",
"required": false,
"name": "page",
"in": "query",
"schema": {
"minimum": 1,
"example": 1,
"type": "number"
}
},
{
"description": "Page size",
"required": false,
"name": "pageSize",
"in": "query",
"schema": {
"minimum": 1,
"example": 25,
"type": "number"
}
},
{
"description": "Include inactive accounts",
"required": false,
"name": "inactiveMode",
"in": "query",
"schema": {
"default": false,
"example": false,
"type": "boolean"
}
}
],
"responses": {
+2 -1
View File
@@ -17,7 +17,8 @@
"build:cjs": "tsup src/index.ts --format cjs --dts --sourcemap",
"build:esm": "tsup src/index.ts --format esm --dts --sourcemap",
"build": "npm run build:cjs && npm run build:esm",
"dev": "npm run build -- --watch"
"dev": "npm run build -- --watch",
"typecheck": "tsc --noEmit"
},
"author": "",
"license": "ISC",
+2 -10
View File
@@ -266,9 +266,6 @@ export async function fetchAutofillCategorizeTransaction(
return data as AutofillCategorizeTransactionResponse;
}
/**
* Uncategorize bank transactions in bulk (DELETE /api/banking/categorize/bulk with query uncategorizedTransactionIds).
*/
export async function uncategorizeTransactionsBulk(
fetcher: ApiFetcher,
uncategorizedTransactionIds: number[],
@@ -276,11 +273,6 @@ export async function uncategorizeTransactionsBulk(
const del = fetcher
.path(BANK_RULES_ROUTES.CATEGORIZE_BULK)
.method('delete')
.create(
{ uncategorizedTransactionIds } as unknown as {
uncategorizedTransactionIds: true | 1;
},
);
// create() binds query; call with no args (params were passed to create())
await (del as unknown as () => Promise<unknown>)();
.create({ uncategorizedTransactionIds: 1 });
await del({ uncategorizedTransactionIds: uncategorizedTransactionIds.map(String) });
}
+1 -1
View File
@@ -154,7 +154,7 @@ export async function fetchRefundCreditNoteTransaction(
refundCreditId: number
): Promise<RefundCreditNoteTransaction> {
const get = fetcher.path(CREDIT_NOTES_ROUTES.REFUND_BY_ID).method('get').create();
const { data } = await get({ refundCreditId });
const { data } = await get({ refundCreditId: String(refundCreditId) } as never);
return data;
}
-1
View File
@@ -20,7 +20,6 @@ export * from './manual-journals';
export * from './roles';
export * from './users';
export * from './dashboard';
export * from './export';
export * from './settings';
export * from './organization';
export * from './subscription';
+4 -1
View File
@@ -37,7 +37,10 @@ export async function buildOrganization(
export async function fetchOrgBaseCurrencyMutateAbilities(
fetcher: ApiFetcher
): Promise<OrgBaseCurrencyMutateAbilitiesResponse> {
const get = fetcher.path(ORGANIZATION_ROUTES.BASE_CURRENCY_MUTATE).method('get').create();
const get = fetcher
.path(ORGANIZATION_ROUTES.BASE_CURRENCY_MUTATE)
.method('get')
.create();
const { data } = await get({});
return data;
}
+19 -1
View File
@@ -15119,6 +15119,24 @@ export interface operations {
onlyInactive?: boolean;
/** @description Structure type for the accounts list */
structure?: "tree" | "flat";
/** @description Custom view ID */
customViewId?: number;
/** @description Filter roles array */
filterRoles?: string[];
/** @description Column to sort by */
columnSortBy?: string;
/** @description Sort order */
sortOrder?: "DESC" | "ASC";
/** @description Stringified filter roles */
stringifiedFilterRoles?: string;
/** @description Search keyword */
searchKeyword?: string;
/** @description View slug */
viewSlug?: string;
/** @description Page number */
page?: number;
/** @description Page size */
pageSize?: number;
};
header: {
/** @description Value must be 'Bearer <token>' where <token> is an API key prefixed with 'bc_' or a JWT token. */
@@ -20656,7 +20674,7 @@ export interface operations {
/** @description Custom view ID */
customViewId?: number;
/** @description Filter roles array */
filterRoles?: unknown[][];
filterRoles?: string[];
/** @description Column to sort by */
columnSortBy?: string;
/** @description Sort order */