mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 16:55:37 +02:00
## Description <!-- Briefly describe the purpose and scope of your changes --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new subscription API endpoint for managing subscriptions and products. - Enhanced subscription management with new entities and functionalities. - Added functionality to retrieve current timestamps in both local and UTC formats. - Added Polar.sh integration with customer portal and checkout session creation APIs. - **Refactor** - Redesigned team details to now present members and subscription information instead of a plan type. - Enhanced member management by incorporating role assignments. - Streamlined user data handling and removed legacy subscription event logic. - Simplified error handling in actor functions for better clarity. - Updated plan types and UI labels to reflect new subscription tiers. - Improved database indexing for Steam user data. - **Chores** - Updated the database schema with new tables and fields to support subscription, team, and member enhancements. - Extended identifier prefixes to broaden system integration. - Added new secrets related to pricing plans in infrastructure configuration. - Configured API and auth routing with new domain and routing rules. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
81 lines
2.4 KiB
TypeScript
81 lines
2.4 KiB
TypeScript
import { prefixes } from "./utils";
|
|
export namespace Examples {
|
|
export const Id = (prefix: keyof typeof prefixes) =>
|
|
`${prefixes[prefix]}_XXXXXXXXXXXXXXXXXXXXXXXXX`;
|
|
|
|
export const Steam = {
|
|
id: Id("steam"),
|
|
userID: Id("user"),
|
|
countryCode: "KE",
|
|
steamID: 74839300282033,
|
|
limitation: {
|
|
isLimited: false,
|
|
isBanned: false,
|
|
isLocked: false,
|
|
isAllowedToInviteFriends: false,
|
|
},
|
|
lastGame: {
|
|
gameID: 2531310,
|
|
gameName: "The Last of Us™ Part II Remastered",
|
|
},
|
|
personaName: "John",
|
|
username: "johnsteamaccount",
|
|
steamEmail: "john@example.com",
|
|
avatarUrl: "https://avatars.akamai.steamstatic.com/XXXXXXXXXXXX_full.jpg",
|
|
}
|
|
|
|
export const User = {
|
|
id: Id("user"),
|
|
name: "John Doe",
|
|
email: "john@example.com",
|
|
discriminator: 47,
|
|
avatarUrl: "https://cdn.discordapp.com/avatars/xxxxxxx/xxxxxxx.png",
|
|
polarCustomerID: "0bfcb712-df13-4454-81a8-fbee66eddca4",
|
|
steamAccounts: [Steam]
|
|
};
|
|
|
|
export const Product = {
|
|
id: Id("product"),
|
|
name: "RTX 4090",
|
|
description: "Ideal for dedicated gamers who crave more flexibility and social gaming experiences.",
|
|
tokensPerHour: 20,
|
|
}
|
|
|
|
export const Subscription = {
|
|
tokens: 100,
|
|
id: Id("subscription"),
|
|
userID: Id("user"),
|
|
teamID: Id("team"),
|
|
planType: "pro" as const, // free, pro, family, enterprise
|
|
standing: "new" as const, // new, good, overdue, cancelled
|
|
polarProductID: "0bfcb712-df13-4454-81a8-fbee66eddca4",
|
|
polarSubscriptionID: "0bfcb712-df13-4454-81a8-fbee66eddca4",
|
|
}
|
|
|
|
export const Member = {
|
|
id: Id("member"),
|
|
email: "john@example.com",
|
|
teamID: Id("team"),
|
|
role: "admin" as const,
|
|
timeSeen: new Date("2025-02-23T13:39:52.249Z"),
|
|
}
|
|
|
|
export const Team = {
|
|
id: Id("team"),
|
|
name: "John Does' Team",
|
|
slug: "john_doe",
|
|
subscriptions: [Subscription],
|
|
members: [Member]
|
|
}
|
|
|
|
export const Machine = {
|
|
id: Id("machine"),
|
|
userID: Id("user"),
|
|
country: "Kenya",
|
|
countryCode: "KE",
|
|
timezone: "Africa/Nairobi",
|
|
location: { latitude: 36.81550, longitude: -1.28410 },
|
|
fingerprint: "fc27f428f9ca47d4b41b707ae0c62090",
|
|
}
|
|
|
|
} |