Skip to content

Commit

Permalink
Merge branch 'master' into stripe-donation-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 authored May 22, 2024
2 parents f596144 + 4d44d38 commit 5f33a1f
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install kubectl
uses: azure/setup-kubectl@v3
uses: azure/setup-kubectl@v4

- name: Install kustomize
uses: imranismail/setup-kustomize@v2
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
contents: write
steps:
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true

Expand All @@ -224,7 +224,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install kubectl
uses: azure/setup-kubectl@v3
uses: azure/setup-kubectl@v4

- name: Install kustomize
uses: imranismail/setup-kustomize@v2
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import { StatisticsModule } from '../statistics/statistics.module'
import { AffiliateModule } from '../affiliate/affiliate.module'
import { StripeModule } from '../stripe/stripe.module'

import { LoggerModule } from '../logger/logger.module'

@Module({
imports: [
ConfigModule.forRoot({
Expand Down Expand Up @@ -128,6 +130,7 @@ import { StripeModule } from '../stripe/stripe.module'
CampaignNewsModule,
CampaignNewsFileModule,
MarketingNotificationsModule,
LoggerModule,
StripeModule,
],
controllers: [AppController],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
import { DonationType } from '@prisma/client'
import { ApiProperty } from '@nestjs/swagger'

export class CreateDonationDto {
@ApiProperty({ enum: DonationType })
type: DonationType
}
export class CreateDonationDto {}
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
import { DonationType } from '@prisma/client'
import { ApiProperty } from '@nestjs/swagger'

export class UpdateDonationDto {
@ApiProperty({ enum: DonationType })
type?: DonationType
}
export class UpdateDonationDto {}
8 changes: 8 additions & 0 deletions apps/api/src/logger/logger.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Module } from '@nestjs/common'
import { MyLogger } from './logger'

@Module({
providers: [MyLogger],
exports: [MyLogger],
})
export class LoggerModule {}
16 changes: 16 additions & 0 deletions apps/api/src/logger/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ConsoleLogger, Injectable } from '@nestjs/common'
import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry'

@Injectable()
export class MyLogger extends ConsoleLogger {
constructor(@InjectSentry() private readonly client: SentryService) {
super()
}

error(message: any, stack?: string, context?: string) {
// add your tailored logic here

this.client.instance().captureMessage(message, 'error')
super.error(message, stack, context)
}
}
3 changes: 3 additions & 0 deletions apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { setupSwagger } from './config/swagger.config'
import { setupExceptions } from './config/exceptions.config'
import { setupValidation } from './config/validation.config'
import { setupShutdownHooks } from './config/shutdown.config'
import { MyLogger } from './logger/logger'
import { LoggerModule } from './logger/logger.module'

const globalPrefix = process.env.GLOBAL_PREFIX ?? 'api/v1'
const logLevels: LogLevel[] = ['error', 'warn']
Expand All @@ -26,6 +28,7 @@ async function bootstrap() {

app.setGlobalPrefix(globalPrefix)
app.enableVersioning({ type: VersioningType.URI })
app.useLogger(app.get(MyLogger))

const appVersion = process.env.APP_VERSION || 'unknown'
setupHelmet(app)
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/tasks/bank-import/import-transactions.task.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpService } from '@nestjs/axios'
import { Logger, Injectable } from '@nestjs/common'
import { Logger, Injectable, BadRequestException } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { SchedulerRegistry } from '@nestjs/schedule'
import {
Expand Down Expand Up @@ -278,7 +278,7 @@ export class IrisTasks {
const endpoint = this.config.get<string>('iris.transactionsEndPoint', '')

const dateFrom = DateTime.fromJSDate(transactionsDate)
const dateTo = dateFrom.plus({ days: 1 })
const dateTo = dateFrom

Logger.debug(
`Getting transactions from date: ${dateFrom.toISODate()} to date: ${dateTo.toISODate()}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "bank_transactions" ALTER COLUMN "description" SET DATA TYPE TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "donations" ALTER COLUMN "type" SET DEFAULT 'donation';
2 changes: 1 addition & 1 deletion podkrepi.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ Table payments {
Table donations {
id String [pk]
paymentId String [not null]
type DonationType [not null]
type DonationType [not null, default: 'donation']
targetVaultId String [not null, note: 'Vault where the funds are going']
amount Int [not null, default: 0]
personId String
Expand Down
4 changes: 2 additions & 2 deletions schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ model Donation {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
paymentId String @map("payment_id") @db.Uuid
type DonationType
type DonationType @default(donation)
/// Vault where the funds are going
targetVaultId String @map("target_vault_id") @db.Uuid
amount Int @default(0)
Expand Down Expand Up @@ -625,7 +625,7 @@ model BankTransaction {
recipientIban String? @map("recipient_iban") @db.VarChar(34)
amount Float @default(0)
currency Currency @default(BGN)
description String @db.VarChar(200)
description String @db.Text
//Matched campaign payment code
matchedRef String? @map("matched_ref") @db.VarChar(100)
type BankTransactionType
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8217,13 +8217,13 @@ __metadata:
linkType: hard

"ejs@npm:^3.1.7":
version: 3.1.9
resolution: "ejs@npm:3.1.9"
version: 3.1.10
resolution: "ejs@npm:3.1.10"
dependencies:
jake: ^10.8.5
bin:
ejs: bin/cli.js
checksum: af6f10eb815885ff8a8cfacc42c6b6cf87daf97a4884f87a30e0c3271fedd85d76a3a297d9c33a70e735b97ee632887f85e32854b9cdd3a2d97edf931519a35f
checksum: ce90637e9c7538663ae023b8a7a380b2ef7cc4096de70be85abf5a3b9641912dde65353211d05e24d56b1f242d71185c6d00e02cb8860701d571786d92c71f05
languageName: node
linkType: hard

Expand Down

0 comments on commit 5f33a1f

Please sign in to comment.