|
|
@@ -0,0 +1,20 @@
|
|
|
+import { Injectable } from '@nestjs/common'
|
|
|
+import { Repository } from 'typeorm'
|
|
|
+import { Gallery } from './entities/gallery.entity'
|
|
|
+import { InjectRepository } from '@nestjs/typeorm'
|
|
|
+
|
|
|
+@Injectable()
|
|
|
+export class GalleryService {
|
|
|
+ constructor(
|
|
|
+ @InjectRepository(Gallery)
|
|
|
+ private readonly galleryRepository: Repository<Gallery>
|
|
|
+ ) {}
|
|
|
+
|
|
|
+ async findAll(): Promise<Gallery[]> {
|
|
|
+ return await this.galleryRepository.find()
|
|
|
+ }
|
|
|
+
|
|
|
+ async save(gallery: Gallery): Promise<Gallery> {
|
|
|
+ return await this.galleryRepository.save(gallery)
|
|
|
+ }
|
|
|
+}
|