mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 02:51:57 +02:00
Migrate removeAddon to zod
GitOrigin-RevId: 957781aaec8b6610b6d7944c24d4755c50c923a1
This commit is contained in:
@@ -650,9 +650,16 @@ async function purchaseAddon(req, res, next) {
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
|
||||
const removeAddonSchema = z.object({
|
||||
params: z.object({
|
||||
addOnCode: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
async function removeAddon(req, res, next) {
|
||||
const user = SessionManager.getSessionUser(req.session)
|
||||
const addOnCode = req.params.addOnCode
|
||||
const { params } = validateReq(req, removeAddonSchema)
|
||||
const addOnCode = params.addOnCode
|
||||
|
||||
if (addOnCode !== AI_ADD_ON_CODE) {
|
||||
return res.sendStatus(404)
|
||||
|
||||
@@ -183,11 +183,6 @@ export default {
|
||||
webRouter.post(
|
||||
'/user/subscription/addon/:addOnCode/remove',
|
||||
AuthenticationController.requireLogin(),
|
||||
validate({
|
||||
params: Joi.object({
|
||||
addOnCode: Joi.string(),
|
||||
}),
|
||||
}),
|
||||
RateLimiterMiddleware.rateLimit(subscriptionRateLimiter),
|
||||
SubscriptionController.removeAddon
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user