Skip to content

Commit

Permalink
Merge pull request #202 from andrechristikan/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
andrechristikan authored Aug 18, 2022
2 parents a292b74 + fad362f commit 72c88c4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ack-nestjs-mongoose-kafka",
"version": "1.2.2",
"version": "1.2.4",
"description": "Ack NestJs Mongoose Kafka",
"repository": {
"type": "git",
Expand Down
2 changes: 2 additions & 0 deletions src/common/auth/guards/api-key/auth.api-key.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export class ApiKeyStrategy extends PassportStrategy(Strategy, 'api-key') {
);
}

// you can change the logic
// difference app - difference logic
async validate(
apiKey: string,
verified: (
Expand Down
4 changes: 4 additions & 0 deletions src/common/file/pipes/file.extract.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export class FileExtractPipe implements PipeTransform {
async transform(
value: IFile | IFile[]
): Promise<IFileExtract | IFileExtract[]> {
if (!value) {
return;
}

if (Array.isArray(value)) {
const extracts: IFileExtract[] = [];

Expand Down
4 changes: 4 additions & 0 deletions src/common/file/pipes/file.max-files.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export class FileMaxFilesImagePipe implements PipeTransform {
constructor(private readonly configService: ConfigService) {}

async transform(value: IFile[]): Promise<IFile[]> {
if (!value) {
return value;
}

await this.validate(value);

return value;
Expand Down
4 changes: 4 additions & 0 deletions src/common/file/pipes/file.size.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export class FileSizeImagePipe implements PipeTransform {
constructor(private readonly configService: ConfigService) {}

async transform(value: IFile | IFile[]): Promise<IFile | IFile[]> {
if (!value) {
return;
}

if (Array.isArray(value)) {
for (const val of value) {
await this.validate(val.size);
Expand Down
5 changes: 5 additions & 0 deletions src/common/file/pipes/file.type.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import { IFile } from '../file.interface';
@Injectable()
export class FileTypeImagePipe implements PipeTransform {
async transform(value: IFile | IFile[]): Promise<IFile | IFile[]> {
if (!value) {
return;
return;
}

if (Array.isArray(value)) {
for (const val of value) {
await this.validate(val.mimetype);
Expand Down
4 changes: 4 additions & 0 deletions src/common/file/pipes/file.validation.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class FileValidationPipe<T> implements PipeTransform {
async transform(
value: IFileExtract<T> | IFileExtract<T>[]
): Promise<IFileExtract<T> | IFileExtract<T>[]> {
if (!value) {
return;
}

if (Array.isArray(value)) {
const classTransforms: IFileExtract<T>[] = [];
for (const val of value) {
Expand Down
2 changes: 1 addition & 1 deletion src/common/middleware/timestamp/timestamp.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class TimestampMiddleware implements NestMiddleware {

const currentTimestamp: number = this.helperDateService.timestamp();

if (mode !== 'secure' && !reqTs) {
if (mode !== 'secure' || !reqTs) {
reqTs = `${currentTimestamp}`;
}

Expand Down

0 comments on commit 72c88c4

Please sign in to comment.