Skip to content

Commit

Permalink
Merge branch 'podkrepi-bg:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
slavcho authored Jan 16, 2024
2 parents 0f1135e + 97adc1f commit 4ed0b21
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -70,4 +70,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Run tests
run: yarn test:ci
- name: Upload test results artifact
uses: actions/upload-artifact@v3 # upload test results
uses: actions/upload-artifact@v4 # upload test results
if: success() || failure() # run this step even if previous step failed
with: # upload a combined archive with unit and integration test results
name: test-results
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export class AuthService {
emailVerified: true,
groups: [],
requiredActions: verifyEmail ? [RequiredActionAlias.VERIFY_EMAIL] : [],
attributes: { selfReg: true },
attributes: { selfReg: true, companyName: registerDto.companyName },
credentials: [
{
type: 'password',
Expand Down Expand Up @@ -433,7 +433,7 @@ export class AuthService {
const user = await this.personService.findOneByKeycloakId(keycloakId)

//Check and throw if user is a beneficiary, organizer or corporate profile
if (!!user && user.beneficiaries.length > 0 || user?.organizer || user?.companyId) {
if ((!!user && user.beneficiaries.length > 0) || user?.organizer || user?.companyId) {
throw new InternalServerErrorException(
'Cannot delete a beneficiary, organizer or corporate profile',
)
Expand Down
4 changes: 3 additions & 1 deletion apps/api/src/config/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SeverityLevel } from '@sentry/node'

/**
* Be sure to add `process.env` vars in validation schema at ./validation.config.ts
*/
Expand All @@ -13,7 +15,7 @@ export default () => ({
environment: process.env.APP_ENV,
debug: false,
enabled: process.env.APP_ENV !== 'development',
logLevel: 'debug',
logLevels: ['error', 'warn'] as SeverityLevel[],
tracesSampleRate: 1.0,
},
sendgrid: {
Expand Down
8 changes: 1 addition & 7 deletions apps/api/src/donations/donations.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,7 @@ export class DonationsController {
@Get('user/:id')
async userDonationById(@Param('id') id: string, @AuthenticatedUser() user: KeycloakTokenParsed) {
const donation = await this.donationsService.getUserDonationById(id, user.sub, user.email)
return {
...donation,
person: {
firstName: user.given_name,
lastName: user.family_name,
},
}
return donation
}

@Post('payment-intent')
Expand Down
13 changes: 1 addition & 12 deletions apps/api/src/donations/donations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,25 +461,14 @@ export class DonationsService {
id: string,
keycloakId: string,
email?: string,
): Promise<(Donation & { person: Person | null }) | null> {
): Promise<Donation | null> {
return await this.prisma.donation.findFirst({
where: {
id,
status: DonationStatus.succeeded,
OR: [{ billingEmail: email }, { person: { keycloakId } }],
},
include: {
person: {
select: {
id: true,
firstName: true,
lastName: true,
company: { select: { companyName: true } },
},
},
affiliate: {
select: { company: { select: { companyName: true } } },
},
targetVault: {
select: {
id: true,
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/donations/helpers/donation-status-updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const changeable: DonationStatus[] = [
DonationStatus.incomplete,
DonationStatus.paymentRequested,
DonationStatus.waiting,
DonationStatus.declined,
DonationStatus.guaranteed,
]
const final: DonationStatus[] = [
DonationStatus.succeeded,
DonationStatus.cancelled,
DonationStatus.deleted,
DonationStatus.declined,
DonationStatus.invalid,
DonationStatus.refund,
]
Expand Down

0 comments on commit 4ed0b21

Please sign in to comment.