Skip to content

add mongo db atlas, free tier and use cases services - #2

Open
leandro-codee wants to merge 1 commit into
tuttodev:mainfrom
leandro-codee:feature/add-mongodb
Open

add mongo db atlas, free tier and use cases services#2
leandro-codee wants to merge 1 commit into
tuttodev:mainfrom
leandro-codee:feature/add-mongodb

Conversation

@leandro-codee

@leandro-codee leandro-codee commented Sep 30, 2024

Copy link
Copy Markdown
Contributor

Lo que se agregó

  • Se agrega mongodb como una alternativa de persistencia usando la capa gratuita que provee MongoDbAtlas
  • Se instala la librería PrismaORM para poder conectamos a este MongoDB
  • Se crea el schema de prisma para almacenar los creadores de contenido
  • Se crea el MongoContentCreatorRepository
  • Se cambia el JSONContentCreatorRepository por MongoContentCreatorRepository en el endpoint get
  • Se agrega el endpoint POST usando MongoContentCreatorRepository para crear un ContentCreator
  • Se agrega validaciones usando la librería zod cuando se quiere crear un ContentCreator

CURLs

Para obtener los content creators

curl --location 'http://localhost:3000/v1/content-creator'

Post Crear un Content Creator (debe fallar porque dentro de socialNetworks debe ser o null o arreglo)

curl --location 'http://localhost:3000/v1/content-creator' \
--header 'Content-Type: application/json' \
--data '{ 
    "name": "nombre de prueba",
    "language": "language de prueba",
    "logoUrl": "logo url",
    "socialNetworks": {
    }
}'

Post Crear un Content Creator (socialNetworks en nulls)

curl --location 'http://localhost:3000/v1/content-creator' \
--header 'Content-Type: application/json' \
--data '{ 
    "name": "nombre de prueba",
    "language": "language de prueba",
    "logoUrl": "logo url",
    "socialNetworks": {
        "ig": null,
        "youtube": null,
        "x": null,
        "twitch": null,
        "github": null
    }
}'

Post Crear un Content Creator (socialNetworks con arreglos)

curl --location 'http://localhost:3000/v1/content-creator' \
--header 'Content-Type: application/json' \
--data '{ 
    "name": "superman",
    "language": "volar",
    "logoUrl": "criptonita",
    "socialNetworks": {
        "ig": ["superman"],
        "youtube": ["superman"],
        "x": ["superman"],
        "twitch": ["superman"],
        "github": ["superman"]
    }
}'

MongoDB Compass

Screenshot 2024-09-30 at 12 45 47 AM

Diagrama / Arquitectura sencilla para ver mas visualmente

Screenshot 2024-09-30 at 12 47 46 AM

@tuttodev

tuttodev commented May 3, 2025

Copy link
Copy Markdown
Owner

Dejame reviso los PR's y el video que dejaste para aprobarlo.


async getAll(): Promise<ContentCreator[]> {
const contentCreators = await this._prismaClient.contentCreator.findMany();
console.log("Esto viene desde el Cluster Mongo DB Atlas");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this console.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants