Implement backend API and database services in Docker setup
- Added a new `api` service for the NestJS backend, including health checks and dependencies on PostgreSQL, Redis, and MinIO. - Introduced PostgreSQL and Redis services with health checks and configurations for data persistence. - Added MinIO for S3-compatible object storage and a one-shot service to initialize required buckets. - Updated the Nginx configuration to proxy requests to the new backend API and MinIO storage. - Enhanced the Dockerfile to support the new API environment variables and configurations. - Updated the `package.json` and `package-lock.json` to include new dependencies for QR code generation and other utilities. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
54
backend/test/mocks/subscription.ts
Normal file
54
backend/test/mocks/subscription.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Subscription } from 'src/subscriptions/entities/subscription.entity';
|
||||
import { SubscriptionPeriod } from 'src/subscriptions/enums/periods.enum';
|
||||
import { PaymentStatus } from 'src/subscriptions/enums/status.enum';
|
||||
import { SubscriptionType } from 'src/subscriptions/enums/types.enum';
|
||||
import { createUser } from './user';
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
|
||||
type SubscriptionParameters = {
|
||||
type?: SubscriptionType;
|
||||
period?: SubscriptionPeriod;
|
||||
status?: PaymentStatus;
|
||||
createdAt?: Date;
|
||||
user?: User;
|
||||
};
|
||||
|
||||
export const createSubscription = ({
|
||||
type = 'enthusiast',
|
||||
period = 'monthly',
|
||||
status = 'succeeded',
|
||||
createdAt = new Date(),
|
||||
user,
|
||||
}: SubscriptionParameters): Subscription => ({
|
||||
id: 'ab2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
stripeId: 'sub_123',
|
||||
status,
|
||||
type,
|
||||
period,
|
||||
userId: 'a2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
user,
|
||||
createdAt,
|
||||
flashEvents: [],
|
||||
});
|
||||
|
||||
export const audienceMonthlyStripe = createSubscription({
|
||||
type: 'enthusiast',
|
||||
period: 'monthly',
|
||||
user: createUser(),
|
||||
});
|
||||
|
||||
export const rssAddonMonthlyStripe = createSubscription({
|
||||
type: 'rss-addon',
|
||||
period: 'monthly',
|
||||
});
|
||||
|
||||
export const verificationAddonMonthlyStripe = createSubscription({
|
||||
type: 'verification-addon',
|
||||
period: 'monthly',
|
||||
});
|
||||
|
||||
export const audienceMonthlyRejectedStripe = createSubscription({
|
||||
type: 'enthusiast',
|
||||
period: 'monthly',
|
||||
status: 'rejected',
|
||||
});
|
||||
Reference in New Issue
Block a user