TypeORM-readme-27.ts
· 252 B · TypeScript
Исходник
import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"
const photoRepository = AppDataSource.getRepository(Photo)
const photoToRemove = await photoRepository.findOneBy({
id: 1,
})
await photoRepository.remove(photoToRemove)
1 | import { Photo } from "./entity/Photo" |
2 | import { AppDataSource } from "./index" |
3 | |
4 | const photoRepository = AppDataSource.getRepository(Photo) |
5 | const photoToRemove = await photoRepository.findOneBy({ |
6 | id: 1, |
7 | }) |
8 | await photoRepository.remove(photoToRemove) |