Skip to content

Commit

Permalink
Merge pull request #357 from code4romania/release/v1.0.13
Browse files Browse the repository at this point in the history
Release v1.0.10
  • Loading branch information
birloiflorian authored Aug 8, 2024
2 parents b240658 + 44678a3 commit c211ca5
Show file tree
Hide file tree
Showing 171 changed files with 18,113 additions and 38,463 deletions.
19,514 changes: 4,103 additions & 15,411 deletions backend/package-lock.json

Large diffs are not rendered by default.

125 changes: 63 additions & 62 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,73 +27,74 @@
},
"dependencies": {
"@anchan828/typeorm-history": "1.0.38",
"@aws-sdk/client-cognito-identity-provider": "^3.474.0",
"@aws-sdk/client-s3": "^3.325.0",
"@aws-sdk/s3-request-presigner": "^3.325.0",
"@bull-board/api": "^4.11.0",
"@bull-board/express": "^4.11.0",
"@nestjs-modules/mailer": "^1.7.1",
"@nestjs/axios": "^2.0.0",
"@nestjs/bull": "^0.6.3",
"@nestjs/common": "^9.0.0",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.0.0",
"@nestjs/event-emitter": "^1.3.1",
"@nestjs/jwt": "^10.0.1",
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/swagger": "^6.1.4",
"@nestjs/throttler": "^4.0.0",
"@nestjs/typeorm": "^9.0.1",
"@types/multer": "^1.4.7",
"axios": "^1.3.1",
"bull": "^4.10.4",
"cache-manager": "^5.1.4",
"@aws-sdk/client-cognito-identity-provider": "^3.614.0",
"@aws-sdk/client-s3": "^3.614.0",
"@aws-sdk/s3-request-presigner": "^3.614.0",
"@bull-board/api": "^5.21.0",
"@bull-board/express": "^5.21.0",
"@nestjs-modules/mailer": "^2.0.2",
"@nestjs/axios": "^3.0.2",
"@nestjs/bull": "^10.1.1",
"@nestjs/cache-manager": "^2.2.2",
"@nestjs/common": "^10.3.10",
"@nestjs/config": "^3.2.3",
"@nestjs/core": "^10.3.10",
"@nestjs/event-emitter": "^2.0.4",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.10",
"@nestjs/swagger": "^7.4.0",
"@nestjs/throttler": "^6.0.0",
"@nestjs/typeorm": "^10.0.2",
"@types/multer": "^1.4.11",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"axios": "^1.7.2",
"bull": "^4.15.1",
"cache-manager": "^5.7.2",
"cache-manager-redis-store": "^3.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"date-fns": "^2.29.3",
"expo-server-sdk": "^3.7.0",
"class-validator": "^0.14.1",
"date-fns": "^3.6.0",
"expo-server-sdk": "^3.10.0",
"handlebars": "^4.7.8",
"helmet": "^6.0.1",
"jwks-rsa": "^3.0.1",
"nestjs-pino": "^3.1.2",
"passport": "^0.6.0",
"helmet": "^7.1.0",
"jwks-rsa": "^3.1.0",
"nestjs-pino": "^4.1.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"pg": "^8.8.0",
"pino-http": "^8.3.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0",
"typeorm": "^0.3.11",
"uuid": "^9.0.0",
"pg": "^8.12.0",
"pino-http": "^10.2.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"typeorm": "^0.3.20",
"uuid": "^10.0.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
"@types/cache-manager": "^4.0.2",
"@types/cache-manager-redis-store": "^2.0.1",
"@types/express": "^4.17.13",
"@types/jest": "29.2.4",
"@types/node": "18.11.18",
"@types/passport-jwt": "^3.0.8",
"@types/supertest": "^2.0.11",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "29.3.1",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.0.3",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.1.1",
"typescript": "^4.7.4"
"@nestjs/cli": "^10.4.2",
"@nestjs/schematics": "^10.1.2",
"@nestjs/testing": "^10.3.10",
"@types/cache-manager": "^4.0.6",
"@types/cache-manager-redis-store": "^2.0.4",
"@types/express": "^4.17.21",
"@types/jest": "29.5.12",
"@types/node": "20.14.10",
"@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.2",
"@types/uuid": "^10.0.0",
"@typescript-eslint/parser": "^7.16.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "29.7.0",
"prettier": "^3.3.2",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "29.2.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "^5.5.3"
},
"jest": {
"moduleFileExtensions": [
Expand All @@ -113,7 +114,7 @@
"testEnvironment": "node"
},
"engines": {
"node": "18.18.2",
"npm": "9.8.1"
"node": "v20.11.1",
"npm": "10.2.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class MobileEventListItemPresenter {

this.location = event.location;
this.eventInterval = formatEventDate(event.startDate, event.endDate);

this.startDate = event.startDate;
this.endDate = event.endDate;

this.organizationLogo = event.organizationLogo;

this.poster = event.poster;
Expand Down Expand Up @@ -43,6 +47,19 @@ export class MobileEventListItemPresenter {
})
location: string;

@Expose()
@ApiProperty({
description: 'Start date of the event',
})
startDate: Date;

@Expose()
@ApiProperty({
description: 'End date of the event',
})
endDate: Date;

// TODO: Deprecate this, remove in the next version. Because of the BE timezone the dates are parsed wrong in the backend we do it in FE.
@Expose()
@ApiProperty({
description:
Expand Down
16 changes: 16 additions & 0 deletions backend/src/api/_mobile/event/presenters/mobile-event.presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export class MobileEventPresenter {
this.isPublic = event.isPublic;

this.location = event.location;

this.eventInterval = formatEventDate(event.startDate, event.endDate);
this.startDate = event.startDate;
this.endDate = event.endDate;

this.organizationLogo = event.organization.logo;

this.targets = event.targets?.map(
Expand Down Expand Up @@ -64,6 +68,18 @@ export class MobileEventPresenter {
})
eventInterval: string;

@Expose()
@ApiProperty({
description: 'Start date of the event',
})
startDate: Date;

@Expose()
@ApiProperty({
description: 'End date of the event',
})
endDate: Date;

@Expose()
@ApiProperty({ description: 'The image of the Event' })
poster: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class OrganizationVolunteerPresenter {
this.name = organization.name;
this.logo = organization.logo;
this.volunteerId = organization.volunteerId;
this.volunteerProfileId = organization.volunteerProfileId;
}

@Expose()
Expand Down Expand Up @@ -35,4 +36,10 @@ export class OrganizationVolunteerPresenter {
description: 'The volunteer id for this organization',
})
volunteerId: string;

@Expose()
@ApiProperty({
description: 'The volunteer profile id for this organization',
})
volunteerProfileId: string;
}
5 changes: 2 additions & 3 deletions backend/src/api/activity-type/activity-type.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ export class ActivityTypeController {
async get(
@Param('id', UuidValidationPipe) activityTypeId: string,
): Promise<ActivityTypePresenter> {
const accessRequest = await this.getOneActivityTypeUseCase.execute(
activityTypeId,
);
const accessRequest =
await this.getOneActivityTypeUseCase.execute(activityTypeId);
return new ActivityTypePresenter(accessRequest);
}

Expand Down
3 changes: 0 additions & 3 deletions backend/src/api/listing/listing.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class ListingController {
): Promise<PaginatedPresenter<IdAndNamePresenter<IEventModel>>> {
const events = await this.getManyEventUseCase.execute({
...filters,
limit: 50,
organizationId,
status: EventStatus.PUBLISHED,
});
Expand All @@ -67,7 +66,6 @@ export class ListingController {
const volunteers = await this.getManyVolunteersUseCase.execute({
...filters,
organizationId: user.organizationId,
limit: 50,
});

return new PaginatedPresenter({
Expand Down Expand Up @@ -103,7 +101,6 @@ export class ListingController {
): Promise<PaginatedPresenter<IdAndNamePresenter<IAdminUserModel>>> {
const admins = await this.getManyAdminUserUseCase.execute({
...filters,
limit: 50,
organizationId,
});

Expand Down
16 changes: 6 additions & 10 deletions backend/src/api/location/dto/get-city.dto.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { IsOptional, IsString, MinLength } from 'class-validator';
import { IsOptional, IsPositive, IsString } from 'class-validator';
import { BasePaginationFilterDto } from 'src/infrastructure/base/base-pagination-filter.dto';

export class GetCityDto {
export class GetCityDto extends BasePaginationFilterDto {
@IsString()
@IsOptional()
@MinLength(3)
search: string;
search?: string;

@IsString()
@IsOptional()
city: string;

@IsString()
@IsPositive()
@IsOptional()
county: string;
countyId?: number;
}
17 changes: 9 additions & 8 deletions backend/src/api/location/location.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { CountyPresenter } from './presenters/county.presenter';
import { Public } from 'src/common/decorators/public.decorator';
import { ApiParam } from '@nestjs/swagger';
import { GetCitiesByCountyIdUseCase } from 'src/usecases/location/get-cities-by-county-id.usecase';
import { PaginatedPresenter } from 'src/infrastructure/presenters/generic-paginated.presenter';

@Public()
@Controller('location')
Expand All @@ -19,14 +20,14 @@ export class LocationController {

@Get('city')
async getCities(
@Query() { search, city, county }: GetCityDto,
): Promise<CityPresenter[]> {
const cities = await this.getCitiesUseCase.execute({
search,
city,
county,
});
return cities.map((city) => new CityPresenter(city));
@Query() options: GetCityDto,
): Promise<PaginatedPresenter<CityPresenter>> {
const cities = await this.getCitiesUseCase.execute(options);

return {
items: cities.items.map((city) => new CityPresenter(city)),
meta: cities.meta,
};
}

@ApiParam({ name: 'countyId', type: 'number' })
Expand Down
2 changes: 1 addition & 1 deletion backend/src/common/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const QUEUES: Record<QUEUES_TYPES, string> = {
};

export const DATE_CONSTANTS = {
YYYY_MM_DD_HH_SS: 'yyyy-MM-dd HH:MM:SS',
YYYY_MM_DD_HH_SS: 'yyyy-MM-dd HH:mm:ss',
YYYY_MM_DD: 'yyyy-MM-dd',
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { BaseEntity } from 'src/infrastructure/base/base-entity';
import { Pagination } from 'src/infrastructure/base/repository-with-pagination.class';
import { SelectQueryBuilder } from 'typeorm';

export interface IRepositoryWithPagination<T extends BaseEntity> {
export interface IRepositoryWithPagination<T> {
paginateQuery<TModel>(
query: SelectQueryBuilder<T>,
limit: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Brackets, Repository, SelectQueryBuilder } from 'typeorm';
import { format } from 'date-fns';
import { DATE_CONSTANTS } from 'src/common/constants/constants';
import { IRepositoryWithPagination } from 'src/common/interfaces/repository-with-pagination.interface';
import { BaseEntity } from './base-entity';

export interface IPaginationMeta {
itemCount: number;
Expand All @@ -17,7 +16,7 @@ export interface Pagination<T> {
meta: IPaginationMeta;
}

export abstract class RepositoryWithPagination<T extends BaseEntity>
export abstract class RepositoryWithPagination<T>
implements IRepositoryWithPagination<T>
{
constructor(private readonly repository: Repository<T>) {}
Expand Down Expand Up @@ -86,16 +85,26 @@ export abstract class RepositoryWithPagination<T extends BaseEntity>
column: string,
start: Date,
end?: Date,
customDateFormat?: string,
): SelectQueryBuilder<T> {
const prefix = column.split('.').join('');
if (end) {
query.andWhere(`${column} BETWEEN :${prefix}Start AND :${prefix}End`, {
[`${prefix}Start`]: format(start, DATE_CONSTANTS.YYYY_MM_DD_HH_SS),
[`${prefix}End`]: format(end, DATE_CONSTANTS.YYYY_MM_DD_HH_SS),
[`${prefix}Start`]: format(
start,
customDateFormat || DATE_CONSTANTS.YYYY_MM_DD_HH_SS,
),
[`${prefix}End`]: format(
end,
customDateFormat || DATE_CONSTANTS.YYYY_MM_DD_HH_SS,
),
});
} else {
query.andWhere(`${column} >= :${prefix}Start`, {
[`${prefix}Start`]: format(start, DATE_CONSTANTS.YYYY_MM_DD),
[`${prefix}Start`]: format(
start,
customDateFormat || DATE_CONSTANTS.YYYY_MM_DD,
),
});
}

Expand Down
6 changes: 3 additions & 3 deletions backend/src/infrastructure/config/cache-config.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Injectable } from '@nestjs/common';
import {
CacheStore,
CacheModuleOptions,
CacheOptionsFactory,
CacheStore,
Injectable,
} from '@nestjs/common';
} from '@nestjs/cache-manager';
import { ConfigService } from '@nestjs/config';
import * as redisStore from 'cache-manager-redis-store';

Expand Down
Loading

0 comments on commit c211ca5

Please sign in to comment.