Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaFomina committed Dec 8, 2024
1 parent e82f134 commit 7df3b69
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 57 deletions.
8 changes: 4 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ BILLING_COMPANY_EMAIL="team@hawk.so"
CODEX_ACCOUNTING_URL=http://accounting:3999/graphql

# Files with certs
TLS_CA_CERT=/usr/src/app/src/accounting/ca.pem
TLS_CERT=/usr/src/app/src/accounting/tls/client.pem
TLS_KEY=/usr/src/app/src/accounting/tls/client-key.pem
TLS_CA_CERT=
TLS_CERT=
TLS_KEY=

## GitHub OAuth app client ID
GITHUB_CLIENT_ID=fakedata
Expand Down Expand Up @@ -84,4 +84,4 @@ AWS_S3_ACCESS_KEY_ID=
AWS_S3_SECRET_ACCESS_KEY=
AWS_S3_BUCKET_NAME=
AWS_S3_BUCKET_BASE_URL=
AWS_S3_BUCKET_ENDPOINT=
AWS_S3_BUCKET_ENDPOINT=
4 changes: 2 additions & 2 deletions src/billing/cloudpayments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ export default class CloudPaymentsWebhooks {
* Cancel payment if it is deferred
*/
if (data.cloudPayments?.recurrent?.startDate) {
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Recurrent payments activated for «${workspace.name}». 1$ charged`, TelegramBotURLs.Money));
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Recurrent payments activated for «${workspace.name}». 1 RUB charged`, TelegramBotURLs.Money));
await cloudPaymentsApi.cancelPayment(body.TransactionId);
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Recurrent payments activated for «${workspace.name}». 1$ returned`, TelegramBotURLs.Money));
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Recurrent payments activated for «${workspace.name}». 1 RUB returned`, TelegramBotURLs.Money));
} else {
/**
* Russia code from ISO 3166-1
Expand Down
5 changes: 3 additions & 2 deletions src/billing/types/enums/cardType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export enum CardType {
VISA = 'Visa',
MASTERCARD = 'Mastercard',
MAESTRO = 'Maestro',
MIR = 'МИР'
}
MIR = 'МИР',
UNION_PAY = 'UnionPay'
}
1 change: 0 additions & 1 deletion src/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const connectionConfig: MongoClientOptions = {
*/
export async function setupConnections(): Promise<void> {
try {
console.log(MongoClient)
const [hawkMongoClient, eventsMongoClient] = await Promise.all([
MongoClient.connect(hawkDBUrl, connectionConfig),
MongoClient.connect(eventsDBUrl, connectionConfig),
Expand Down
47 changes: 0 additions & 47 deletions src/resolvers/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,53 +128,6 @@ module.exports = {
return release;
},
},
Subscription: {
eventOccurred: {
/**
* Subscribes user to events from his projects
* @param {ResolverObj} _obj
* @param {Object} _args - request variables (not used)
* @param {UserInContext} user - current authorized user {@see ../index.js}
* @param {ContextFactories} factories - factories for working with models
* @return {AsyncIterator<EventSchema>}
*/
subscribe: async (_obj, _args, { user, factories }) => {
const userId = user.id;
const userModel = await factories.usersFactory.findById(userId);
// eslint-disable-next-line no-async-promise-executor
const eventsCollections = new Promise(async resolve => {
// @todo optimize query for getting all user's projects

// Find all user's workspaces
const allWorkspacesIds = await userModel.getWorkspacesIds();
const allProjects = [];

// Find all user's projects
await asyncForEach(allWorkspacesIds, async workspaceId => {
const allProjectsInWorkspace = await new ProjectToWorkspace(workspaceId).getProjects();

allProjects.push(...allProjectsInWorkspace);
});

resolve(allProjects.map(project =>
mongo.databases.events
.collection('events:' + project.id)
));
});

return watchController.getAsyncIteratorForCollectionChangesEvents(eventsCollections);
},

/**
* Sends data to user about new events
* @param {Object} payload - subscription event payload (from mongoDB watch)
* @return {EventSchema}
*/
resolve: (payload) => {
return payload.fullDocument;
},
},
},
Mutation: {
/**
* Mark event as visited for current user
Expand Down
2 changes: 1 addition & 1 deletion src/typeDefs/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ type PayloadOfWorkspacePlanPurchase {
workspace: Workspace!
"""
Amount of payment * 100
1/100 of the final amount. (US cents for USD, kopecks for RUB)
"""
amount: Long!
Expand Down

0 comments on commit 7df3b69

Please sign in to comment.