mirror of
https://github.com/Litlyx/litlyx
synced 2026-02-04 22:52:19 +01:00
add code redeem
This commit is contained in:
14
dashboard/server/api/pay/valid_codes.ts
Normal file
14
dashboard/server/api/pay/valid_codes.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { AppsumoCodeTryModel } from "@schema/AppsumoCodeTrySchema";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const data = await getRequestData(event, { requireSchema: false, allowGuests: false, allowLitlyx: false });
|
||||
if (!data) return;
|
||||
|
||||
const { pid } = data;
|
||||
|
||||
const tryRes = await AppsumoCodeTryModel.findOne({ project_id: pid }, { valid_codes: 1 });
|
||||
if (!tryRes) return { count: 0 }
|
||||
return { count: tryRes.valid_codes.length }
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user