fix: update / create feature with empty ID / name
This commit is contained in:
@@ -12,6 +12,7 @@ export const ADMIN_USER_IDs = [
|
|||||||
"user_2tMgAiPsQzX8JTHjZZh9m0VdvUv", // a
|
"user_2tMgAiPsQzX8JTHjZZh9m0VdvUv", // a
|
||||||
"user_2sB3tBXsnVVLlTKliQIqvvM2xfB", // j
|
"user_2sB3tBXsnVVLlTKliQIqvvM2xfB", // j
|
||||||
"ZsDswIXyOGMP9y1V1At4dAZNaiggClSs", // t
|
"ZsDswIXyOGMP9y1V1At4dAZNaiggClSs", // t
|
||||||
|
"NqNuL3MtS7MR2WYoqx2b28iY9vmfAs8h", // c
|
||||||
];
|
];
|
||||||
// process.env.ENV === "production" || process.env.NODE_ENV === "production"
|
// process.env.ENV === "production" || process.env.NODE_ENV === "production"
|
||||||
// ? [
|
// ? [
|
||||||
|
|||||||
@@ -71,5 +71,12 @@ describe(`${chalk.yellowBright("temp: Testing add ons")}`, () => {
|
|||||||
customer_id: customerId,
|
customer_id: customerId,
|
||||||
product_id: oneOff.id,
|
product_id: oneOff.id,
|
||||||
});
|
});
|
||||||
|
await autumn.attach({
|
||||||
|
customer_id: customerId,
|
||||||
|
product_id: oneOff.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
const customer = await autumn.customers.get(customerId);
|
||||||
|
console.log("Customer:", customer);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,8 +19,12 @@ const featureDescriptions = {
|
|||||||
// Create Feature Params
|
// Create Feature Params
|
||||||
export const CreateFeatureV1ParamsSchema = z
|
export const CreateFeatureV1ParamsSchema = z
|
||||||
.object({
|
.object({
|
||||||
id: z.string().meta({ description: featureDescriptions.id }),
|
id: z.string().nonempty().meta({ description: featureDescriptions.id }),
|
||||||
name: z.string().nullish().meta({ description: featureDescriptions.name }),
|
name: z
|
||||||
|
.string()
|
||||||
|
.nonempty()
|
||||||
|
.nullish()
|
||||||
|
.meta({ description: featureDescriptions.name }),
|
||||||
type: z.enum(FeatureType).meta({ description: featureDescriptions.type }),
|
type: z.enum(FeatureType).meta({ description: featureDescriptions.type }),
|
||||||
consumable: z.boolean().optional(),
|
consumable: z.boolean().optional(),
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ function UpdateFeatureSheet({
|
|||||||
try {
|
try {
|
||||||
await FeatureService.updateFeature(axiosInstance, selectedFeature.id, {
|
await FeatureService.updateFeature(axiosInstance, selectedFeature.id, {
|
||||||
...feature,
|
...feature,
|
||||||
id: feature.id,
|
id: feature.id || undefined,
|
||||||
name: feature.name,
|
name: feature.name || undefined,
|
||||||
type: feature.type,
|
type: feature.type,
|
||||||
consumable: feature.config?.usage_type === FeatureUsageType.Single,
|
consumable: feature.config?.usage_type === FeatureUsageType.Single,
|
||||||
event_names: feature.event_names,
|
event_names: feature.event_names,
|
||||||
|
|||||||
Reference in New Issue
Block a user