Skip to content

Conversation

lexiv0re
Copy link
Collaborator

@lexiv0re lexiv0re commented Oct 20, 2025

Subs feature preview (complete backend & client)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
@lexiv0re lexiv0re requested review from aonnikov and Copilot October 20, 2025 06:50
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a subscription management system for the Huly Platform, adding support for tracking workspace subscriptions with billing provider integration. The implementation provides a provider-agnostic abstraction for managing subscription statuses, types, and billing periods.

Key changes:

  • Added comprehensive subscription type definitions and enums for status and types
  • Implemented service operations for upserting subscriptions (billing service only)
  • Added user operations for retrieving subscriptions with role-based access control

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
server/account/src/types.ts Defines subscription enums (SubscriptionStatus, SubscriptionType) and Subscription interface with provider-agnostic fields
server/account/src/serviceOperations.ts Implements upsertSubscription function for billing service to create/update subscriptions
server/account/src/operations.ts Adds getSubscriptions function with role-based access control for workspace owners/maintainers
server/account/src/collections/postgres/postgres.ts Integrates subscription collection into PostgreSQL database implementation
server/account/src/collections/postgres/migrations.ts Adds V19 migration to create subscription table with proper indexes and constraints
server/account/src/collections/mongo.ts Integrates subscription collection into MongoDB database implementation
server/account/src/tests/serviceOperations.test.ts Comprehensive test coverage for upsertSubscription function
server/account/src/tests/operations.test.ts Complete test coverage for getSubscriptions function including access control

@huly-github-staging
Copy link

Connected to Huly®: UBERF-13958

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
}
// TODO: verify all plans are present in the config - take them from model?
// hardcoded check for now
const mustHave = ['common@tier', 'rare@tier', 'epic@tier', 'legendary@tier']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take this from model, should it be something like billing:tier:Common?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we can, although I think we should still have type and plan fields in the descriptor object explicitly even if we declare them this way

export async function createServer (ctx: MeasureContext, config: Config): Promise<{ app: Express, close: () => void }> {
const app = express()
app.use(cors())
app.use(express.json({ limit: '50mb' }))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: limit makes sense only for services that accept huge payload, can be removed here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought it also helps to prevent dealing with unwanted oversized payloads which someone with bad intentions might be sending? If not I can remove, if it helps I'd reduce the limit to 5mb or something like this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember there is a default limit that is small enough. 50mb is used to increase the limit.

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants