Getting Started

Before starting you need to be authenticated, since the package is hosted within a private npm registry, the authentication steps are described before.

Authentication chevron-right

First, you need to install the package using the following command:

npm i @tradinos/cms-backend-media

Second, in your Pirsma schema file, you have to add

model Media {
    id String @id @default(uuid())

    name     String
    path     String
    mimeType String
    size     Int?

    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
}

Third, Either Provide the Storage Module [Backend] Generic Storage or provide its options directly in the MediaModule options

Lastly, in your module, you need to importMediaModule

import { Module } from '@nestjs/common';
import { MediaModule } from '@tradinos/cms-backend-media';

@Module({
  imports: [
    MediaModule.register({
      prismaClient: PrismaClient,
      swagger: true
    })
  ],
})
export class AppModule {}

Last updated