From cabb6233a3e8a7576802d07c61ffa0763babea8a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Jul 2026 20:42:40 +0200 Subject: [PATCH] Add profiles.maxRating for per-profile content tiers (#14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each profile may carry a maxRating token ("kids" | "twelve" | "fifteen" | "unrestricted") capping which movies/TV it can browse and play. Empty means "no explicit tier" — the client falls back to the account default (a child profile resolves to "kids"). Plain text, opaque to the server: all filtering is client-side like the kids filter, and a string column lets the app add tiers without another migration. Co-Authored-By: Claude Opus 4.8 --- .../1787000000_profile_max_rating.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pb_migrations/1787000000_profile_max_rating.js diff --git a/pb_migrations/1787000000_profile_max_rating.js b/pb_migrations/1787000000_profile_max_rating.js new file mode 100644 index 0000000..02e935b --- /dev/null +++ b/pb_migrations/1787000000_profile_max_rating.js @@ -0,0 +1,23 @@ +/// + +// Per-profile content ceiling (issue #14 follow-up). Each profile may carry a +// `maxRating` — one of the app's RatingTier tokens ("kids" | "twelve" | +// "fifteen" | "unrestricted") — restricting which movies/TV it may browse and +// play. Empty means "no explicit tier": the client falls back to the account's +// default (a child profile resolves to "kids"). Stored as a plain text token, +// opaque to the server (all filtering is client-side, like the kids filter); +// keeping it a string, not an enum column, lets the app add tiers without a +// further migration. +migrate((app) => { + const profiles = app.findCollectionByNameOrId("profiles") + profiles.fields.add(new Field({ + type: "text", + name: "maxRating", + max: 20, + })) + app.save(profiles) +}, (app) => { + const profiles = app.findCollectionByNameOrId("profiles") + profiles.fields.removeByName("maxRating") + app.save(profiles) +})