Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Module } from '@nestjs/common';
import { AzureStorageModule } from '@nestjs/azure-storage';
import { AzureTableStorageModule } from '@nestjs/azure-database';
import { CatController } from './cat.controller';
import { Cat } from './cat.entity';
import { CatService } from './cat.service';
@Module({
imports: [
AzureTableStorageModule.forFeature(Cat, {
table: 'cats',
createTableIfNotExists: true,
}),
AzureStorageModule.withConfig({
sasKey: process.env.AZURE_STORAGE_SAS_KEY,
accountName: process.env.AZURE_STORAGE_ACCOUNT,
containerName: 'nitro-cats-container',
}),
],
providers: [CatService],
controllers: [CatController],
})
export class CatModule {}
import {
EntityPartitionKey,
EntityRowKey,
EntityString,
EntityInt32,
EntityDateTime,
} from '@nestjs/azure-database';
@EntityPartitionKey('cats')
@EntityRowKey('id')
export class Cat {
@EntityString() url: string;
@EntityInt32() rating: number;
@EntityDateTime() createdAt: Date;
constructor(cat?: Partial) {
Object.assign(this, cat);
}
}
import {
EntityPartitionKey,
EntityRowKey,
EntityString,
EntityInt32,
EntityDateTime,
} from '@nestjs/azure-database';
@EntityPartitionKey('cats')
@EntityRowKey('id')
export class Cat {
@EntityString() url: string;
@EntityInt32() rating: number;
@EntityDateTime() createdAt: Date;
constructor(cat?: Partial) {
Object.assign(this, cat);
}
}
constructor(
@InjectRepository(Cat)
private readonly catRepository: Repository,
) {}