Abo-Spiegel: Produkt und tatsächlicher Preis aus den Stripe-Positionen
Neues Appwrite-Feld subscriptions.productKey (Setup-Skript). Ohne bekannten Abo-Preis gilt ein Abo weiter als Wartungs-Abo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
54defb75c4
commit
d097704d49
4 files changed
+88
-2
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
|
||||
/**
|
||||
* Attribut-Schlüssel einer Collection, wie sie scripts/setup-abo-collections.mjs in Appwrite
|
||||
* anlegt. Tests geben sie dem Appwrite-Nachbau als Schema: Schreibt der Code ein Feld, das das
|
||||
* Setup-Skript nicht anlegt, scheitert der Test wie Appwrite in Produktion.
|
||||
*/
|
||||
export function schemaKeys(collection) {
|
||||
const src = readFileSync(new URL('../../scripts/setup-abo-collections.mjs', import.meta.url), 'utf8')
|
||||
const start = src.indexOf(`'${collection}',`)
|
||||
if (start < 0) throw new Error(`Collection ${collection} fehlt im Setup-Skript`)
|
||||
const block = src.slice(start, src.indexOf('\n ],', start))
|
||||
return [...block.matchAll(/key: '(\w+)'/g)].map((m) => m[1])
|
||||
}
|
||||
Reference in new issue
Block a user