fix: removed from events

This commit is contained in:
John Yeo
2025-03-02 15:38:35 +00:00
parent bde76abdb0
commit a3840d3a7d
4 changed files with 1 additions and 15 deletions

View File

@@ -17,7 +17,7 @@
"clean": "tsx src/clean.ts",
"test-all": "mocha 'tests/**/*.ts'",
"test": "mocha 'tests/**/*.ts' --ignore ",
"test-custom": "mocha --timeout 1000000 'tests/09_advanced_usage.ts' 'tests/10_multi_interval.ts' 'tests/11_arrear_prorated.ts' 'tests/12_group_by.ts'"
"test-custom": "mocha --timeout 1000000 'tests/09_advanced_usage.ts'"
},
"mocha": {
"node-option": [

View File

@@ -81,7 +81,6 @@ const getEventAndCustomer = async ({
env: env,
internal_customer_id: customer.internal_id,
timestamp: eventTimestamp,
adjust_allowance: parsedEvent.adjust_allowance || false,
};
await EventService.insertEvent(sb, newEvent);
@@ -168,16 +167,6 @@ export const handleEventSent = async ({
env,
});
if (event.adjust_allowance === true && affectedFeatures.length > 1) {
throw new RecaseError({
message: `Not allowed to adjust allowance for features and credit systems: ${affectedFeatures
.map((f) => f.id)
.join(", ")}`,
code: ErrCode.AdjustAllowanceNotAllowed,
statusCode: 400,
});
}
if (affectedFeatures.length > 0) {
const payload = {
customerId: customer.internal_id,

View File

@@ -88,7 +88,6 @@ export const ErrCode = {
InvalidEvent: "invalid_event",
CreateEventFailed: "create_event_failed",
DuplicateEvent: "duplicate_event",
AdjustAllowanceNotAllowed: "adjust_allowance_not_allowed",
// Cus Product
NoActiveCusProducts: "no_active_cus_products",

View File

@@ -6,7 +6,6 @@ export const EventSchema = z.object({
event_name: z.string().nonempty(),
properties: z.record(z.string(), z.any()),
idempotency_key: z.string().nullish(),
adjust_allowance: z.boolean().nullish(),
// Internal usage
id: z.string(),
@@ -22,7 +21,6 @@ export const CreateEventSchema = z.object({
properties: z.record(z.string(), z.any()).nullish(),
timestamp: z.number().nullish(),
idempotency_key: z.string().nullish(),
adjust_allowance: z.boolean().nullish(),
});
export type Event = z.infer<typeof EventSchema>;