Add new purchase API

This commit is contained in:
Jonas Lochmann
2022-09-26 02:00:00 +02:00
parent 35acd05d08
commit 58a6359a3e
18 changed files with 534 additions and 22 deletions
+2 -3
View File
@@ -24,16 +24,15 @@ const day = 1000 * 60 * 60 * 24
const month = day * 31
const year = day * 366
export const addPurchase = async ({ database, familyId, type, transactionId, websocket, transaction }: {
export const addPurchase = async ({ database, familyId, type, service, transactionId, websocket, transaction }: {
database: Database
familyId: string
type: 'month' | 'year'
service: 'googleplay' | 'directpurchase'
transactionId: string
websocket: WebsocketApi
transaction: Transaction
}) => {
const service = 'googleplay'
const oldPurchaseEntry = await database.purchase.findOne({
where: {
service,