Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
472c9a8
BAN-113 chore: add socket.io-client
backtobackend Oct 2, 2025
db76b10
BAN-113 feat: websocket refactor in proccess
backtobackend Oct 3, 2025
982a0e4
jenkinsfile
backtobackend Oct 14, 2025
c17f530
js
backtobackend Oct 14, 2025
f172066
try
backtobackend Oct 16, 2025
66f391f
BAN-113
backtobackend Oct 16, 2025
56e39e1
BAN-113: jenkins
backtobackend Oct 16, 2025
8078370
BAN-113 deployment
backtobackend Oct 16, 2025
acc992d
...
backtobackend Oct 16, 2025
23e6714
BAN-113
backtobackend Oct 16, 2025
a69524d
users deployment
backtobackend Oct 16, 2025
a1dfc07
posts deployment
backtobackend Oct 16, 2025
aaeb0ec
files deploy
backtobackend Oct 17, 2025
d41d5b0
business deployment
backtobackend Oct 17, 2025
e50ffff
Deployment
backtobackend Oct 17, 2025
a671f62
mailer deploy
backtobackend Oct 17, 2025
a228f20
gate fix config
backtobackend Oct 17, 2025
10dde1a
gate prod
backtobackend Oct 17, 2025
0b60125
env gate change
backtobackend Oct 17, 2025
761799d
logs
backtobackend Oct 17, 2025
11909c8
ENV PORT GATE
backtobackend Oct 17, 2025
da6b125
remove api/v1 from gate configuration
backtobackend Oct 18, 2025
2207266
gate deployment
backtobackend Oct 18, 2025
40769e9
ddd
backtobackend Oct 18, 2025
5d55be9
fff
backtobackend Oct 18, 2025
fd4511d
....
backtobackend Oct 18, 2025
49c7d39
autoLoadEntities true
backtobackend Oct 18, 2025
266a081
business typeorm
backtobackend Oct 18, 2025
eadae20
Merge branch 'main' into refactor/BAN-113-Notifications-Gate
backtobackend226 Oct 17, 2025
ba4720e
business typeorm
backtobackend Oct 18, 2025
bb10776
BAN--113 fix: remove cors
backtobackend Oct 22, 2025
82c6cc6
BAN-113 cors *
backtobackend Oct 22, 2025
8aeb780
return cors
backtobackend Oct 23, 2025
e520256
+ * headers
backtobackend Oct 23, 2025
5423827
return link when subscribe
backtobackend Oct 24, 2025
5af9a5f
add paypal cors
backtobackend Oct 24, 2025
7f2e901
BAN-113 redirect to the front at the end of subscription process
backtobackend Oct 25, 2025
434c316
BAN-113 log
backtobackend Oct 25, 2025
aa62862
BAN-113 comment notif
backtobackend Oct 25, 2025
e4414d5
BAN-113 google redirect
backtobackend Oct 27, 2025
6e2e0a8
BAN-113 user cant have more than 2 not expired subscriptions simultan…
backtobackend Oct 27, 2025
9727632
BAN-113 business redirect gate
backtobackend Oct 27, 2025
2a5f320
BAN-113 feat: cancel subscription
backtobackend Oct 28, 2025
516c0d2
BAN-113 feat: paypal does not spam webhooks
backtobackend Oct 28, 2025
e86f587
BAN logs
backtobackend Nov 6, 2025
7c82d97
BAN-113
backtobackend Nov 6, 2025
6769141
BAN-113 feat: add successUrl and cancelUrl
backtobackend Nov 6, 2025
21afc38
/...
backtobackend Nov 6, 2025
f65a36d
BAN-113 feat: add expiresAt to paymentresponsedto
backtobackend Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/business/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pipeline {
agent any
environment {
ENV_TYPE = "production"
PORT = 3986
PORT = 4052
NAMESPACE = "yogram-ru"
REGISTRY_HOSTNAME = "idogmat"
PROJECT = "business"
PROJECT = "yogram-business"
SERVICE="business"
REGISTRY = "registry.hub.docker.com"
DEPLOYMENT_NAME = "business-deployment"
DEPLOYMENT_NAME = "yogram-business-deployment"
IMAGE_NAME = "${env.BUILD_ID}_${env.ENV_TYPE}_${env.GIT_COMMIT}"
DOCKER_BUILD_NAME = "${env.REGISTRY_HOSTNAME}/${env.PROJECT}:${env.IMAGE_NAME}"
}
Expand Down
64 changes: 32 additions & 32 deletions apps/business/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,63 @@ spec:
- containerPort: PORT_CONTAINER

env:
- name: POSTGRES_TYPE
valueFrom:
secretKeyRef:
name: business-production-config-secret
key: POSTGRES_TYPE
- name: BUSINESS_SERVICE_URL
valueFrom:
secretKeyRef:
name: business-production-config-secret
key: BUSINESS_SERVICE_URL
- name: POSTGRES_URL_SLAVE
valueFrom:
secretKeyRef:
name: business-production-config-secret
key: POSTGRES_URL_SLAVE
- name: PAYPAL_CLIENT_ID
valueFrom:
secretKeyRef:
name: business-production-config-secret
key: PAYPAL_CLIENT_ID
- name: PAYPAL_SECRET
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: PAYPAL_SECRET
- name: USERS_SERVICE_URL
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: USERS_SERVICE_URL
- name: REDIS_USER
valueFrom:
secretKeyRef:
name: business-production-config-secret
key: REDIS_USER
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: REDIS_PASSWORD
- name: REDIS_HOST
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: REDIS_HOST
- name: REDIS_PORT
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: REDIS_PORT
- name: TIME_PERIOD
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: TIME_PERIOD
- name: REDIS_USER
valueFrom:
secretKeyRef:
name: yogram-business-production-config-secret
key: REDIS_USER
- name: BUSINESS_SERVICE_URL
valueFrom:
secretKeyRef:
name: yogram-business-production-config-secret
key: BUSINESS_SERVICE_URL
- name: POSTGRES_TYPE
valueFrom:
secretKeyRef:
name: yogram-business-production-config-secret
key: POSTGRES_TYPE
- name: POSTGRES_URL
valueFrom:
secretKeyRef:
name: business-production-config-secret
name: yogram-business-production-config-secret
key: POSTGRES_URL
- name: PROFILE_SETTINGS_PAGE
valueFrom:
secretKeyRef:
name: yogram-business-production-config-secret
key: PROFILE_SETTINGS_PAGE
- name: PAYPAL_CLIENT_ID
valueFrom:
secretKeyRef:
name: yogram-business-production-config-secret
key: PAYPAL_CLIENT_ID
21 changes: 20 additions & 1 deletion apps/business/src/api/business.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
Param,
Patch,
Post,
Res,
Sse,
} from '@nestjs/common';
import {
Expand All @@ -38,13 +39,17 @@ import {
import { NotificationResponseDto } from 'apps/libs/Business/dto/response/response-notification.dto';
import { ReadNotificationCommand } from '../application/command/read-notification.command';
import { ReadNotificationDto } from '../../../../apps/libs/Business/dto/input/read-notification.dto';
import { Response } from 'express';
import { ConfigService } from '@nestjs/config';
import { CancelSubscriptionCommand } from '../application/command/cancel-subscription.handler';

@Controller()
export class BusinessController {
private eventEmitter: EventEmitter2;
constructor(
private readonly commandBus: CommandBus,
private readonly queryBus: QueryBus,
private readonly configService: ConfigService,
) {
this.eventEmitter = new EventEmitter2();
}
Expand All @@ -57,8 +62,16 @@ export class BusinessController {
@Post('business/paypal-proccess')
async paypalProcess(
@Body('subscriptionId') subscriptionId: string,
@Res() res: Response,
): Promise<void> {
await this.commandBus.execute(new SaveSubscriptionCommand(subscriptionId));
const subscription = await this.commandBus.execute(
new SaveSubscriptionCommand(subscriptionId),
);
res.status(200).json(subscription);
// let page = this.configService.get<string>('PROFILE_SETTINGS_PAGE');
// page = page.replace('replace', subscription.userId);
// console.log('🚀 ~ BusinessController ~ paypalProcess ~ page:', page);
// res.redirect(301, 'https://www.google.com/');
}

@HttpCode(200)
Expand Down Expand Up @@ -113,6 +126,12 @@ export class BusinessController {
return await this.commandBus.execute(new ActivateSubscriptionCommand(id));
}

@Patch('business/subscriptions/:id/cancel')
async cancelSubscription(@Param('id') id: string): Promise<void> {
console.log('🚀 ~ BusinessController ~ cancelSubscription ~ id:', id);
return await this.commandBus.execute(new CancelSubscriptionCommand(id));
}

@Get('business/subscriptions/get/:id')
async getCurrentSubscriptions(
@Param('id') userId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { BusinessCommandService } from '../../business-command.service';

export class CancelSubscriptionCommand {
constructor(public readonly id: string) {}
}

@CommandHandler(CancelSubscriptionCommand)
export class CancelSubscriptionHandler
implements ICommandHandler<CancelSubscriptionCommand>
{
constructor(
private readonly businessCommandService: BusinessCommandService,
) {}

async execute({ id }: CancelSubscriptionCommand): Promise<any> {
return await this.businessCommandService.cancelSubscription(id);
}
}
21 changes: 11 additions & 10 deletions apps/business/src/application/command/save-subscribtion.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ export class SaveSubscriptionHandler
};

const key = getNotificationKey(subscription, notification);
await this.notificationGateway.saveNotification(
key,
notification,
2629746000,
);
await this.notificationGateway.send(
notification,
WebsocketEvents.SubscriptionActive,
30000,
);
// todo uncomment notif
// await this.notificationGateway.saveNotification(
// key,
// notification,
// 2629746000,
// );
// await this.notificationGateway.send(
// notification,
// WebsocketEvents.SubscriptionActive,
// 30000,
// );
return subscription;
}
}
Loading