feat: deduct from redis new api schema

This commit is contained in:
John Yeo
2025-11-11 16:01:14 +00:00
669 changed files with 40353 additions and 13730 deletions

View File

@@ -2,9 +2,16 @@ import { RecaseError } from "../../../index.js";
import { BalancesErrorCode } from "../codes/balancesErrCodes.js";
export class InsufficientBalanceError extends RecaseError {
constructor(opts?: { message?: string }) {
constructor(opts?: {
message?: string;
value: number;
featureId?: string;
eventName?: string;
}) {
super({
message: opts?.message || "Insufficient balance",
message:
opts?.message ||
`Insufficient balance to deduct ${opts?.value} from ${opts?.featureId ? `feature ${opts?.featureId}` : `event ${opts?.eventName}`}`,
code: BalancesErrorCode.InsufficientBalance,
statusCode: 400,
});

View File

@@ -0,0 +1,13 @@
import { RecaseError } from "../base/RecaseError.js";
import { EntityErrorCode } from "../codes/entityErrCodes.js";
export class EntityNotFoundError extends RecaseError {
constructor(opts: { entityId: string }) {
super({
message: `Entity ${opts.entityId} not found`,
code: EntityErrorCode.EntityNotFound,
statusCode: 404,
});
this.name = "EntityNotFoundError";
}
}