fix: removed from events
This commit is contained in:
@@ -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": [
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user