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',
|
||||
});
|
||||
82
backend/test/mocks/user.ts
Normal file
82
backend/test/mocks/user.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
import {
|
||||
audienceMonthlyStripe,
|
||||
rssAddonMonthlyStripe,
|
||||
verificationAddonMonthlyStripe,
|
||||
} from './subscription';
|
||||
import { Subscription } from 'src/subscriptions/entities/subscription.entity';
|
||||
import { Filmmaker } from 'src/filmmakers/entities/filmmaker.entity';
|
||||
|
||||
interface UserParameters {
|
||||
id?: string;
|
||||
email?: string;
|
||||
legalName?: string;
|
||||
profilePictureUrl?: string;
|
||||
subscriptions?: Subscription[];
|
||||
filmmaker?: Filmmaker;
|
||||
}
|
||||
export const createUser = ({
|
||||
id = 'a2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
email = 'test@oneseventech.com',
|
||||
legalName = 'Test User',
|
||||
profilePictureUrl = 'https://example.com/profile.jpg',
|
||||
subscriptions = [],
|
||||
filmmaker,
|
||||
}: UserParameters = {}): User => {
|
||||
return {
|
||||
cognitoId: 'test-cognito-id',
|
||||
id,
|
||||
email,
|
||||
legalName,
|
||||
profilePictureUrl,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
subscriptions,
|
||||
filmmaker,
|
||||
seasonRents: [],
|
||||
redemptions: [],
|
||||
};
|
||||
};
|
||||
|
||||
const createFilmmaker = (
|
||||
id: string,
|
||||
userId: string,
|
||||
professionalName: string,
|
||||
bio: string,
|
||||
): any => {
|
||||
return {
|
||||
id,
|
||||
userId,
|
||||
professionalName,
|
||||
lightningAddress: '',
|
||||
bio,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
};
|
||||
|
||||
export const audienceUserStripe: User = createUser({
|
||||
subscriptions: [audienceMonthlyStripe],
|
||||
});
|
||||
|
||||
export const proPlusUserStripe: User = createUser({
|
||||
subscriptions: [rssAddonMonthlyStripe],
|
||||
filmmaker: createFilmmaker(
|
||||
'a2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
'a2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
'Test Filmmaker',
|
||||
'Test bio',
|
||||
),
|
||||
});
|
||||
|
||||
export const ultimateUserStripe: User = createUser({
|
||||
subscriptions: [verificationAddonMonthlyStripe],
|
||||
filmmaker: createFilmmaker(
|
||||
'a2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
'a2b9b1b0-0b1b-4b1b-8b1b-2b1b3b1b4b1b5',
|
||||
'Test Filmmaker',
|
||||
'Test bio',
|
||||
),
|
||||
});
|
||||
|
||||
export const audienceUserNoSubscription: User = createUser();
|
||||
Reference in New Issue
Block a user