Skip to content

Instantly share code, notes, and snippets.

View Isradeveloper's full-sized avatar

Israel Trujillo Domínguez Isradeveloper

View GitHub Profile
@Isradeveloper
Isradeveloper / parse-mongo-id.pipe.ts
Created July 19, 2024 15:04
NEST JS- Pipe para la validación de MongoID
import {
ArgumentMetadata,
BadRequestException,
Injectable,
PipeTransform,
} from '@nestjs/common';
import { isValidObjectId } from 'mongoose';
@Injectable()
export class ParseMongoIdPipe implements PipeTransform {
/*
AWS SDK for Node.js provides the s3.listObjects API which
lists the objects from a bucket. However, if you have a lot
of objects in your bucket then the response of this API is
truncated. So, the entire contents of a bucket cannot be
fetched in a single API call and you need to call the API
multiple times, each time passing a `marker` parameter which
is the `Key` of the last element of the previous response.
This gist is demonstrating the same. This script uses async/await
feature of the Node.js so make sure you have the appropirate