Naposledy aktivní 1729144992

knox revidoval tento gist 1729144992. Přejít na revizi

1 file changed, 12 insertions

TypeORM-readme-22.ts(vytvořil soubor)

@@ -0,0 +1,12 @@
1 + import { Photo } from "./entity/Photo"
2 + import { AppDataSource } from "./index"
3 +
4 + const photo = new Photo()
5 + photo.name = "Me and Bears"
6 + photo.description = "I am near polar bears"
7 + photo.filename = "photo-with-bears.jpg"
8 + photo.views = 1
9 + photo.isPublished = true
10 +
11 + await AppDataSource.manager.save(photo)
12 + console.log("Photo has been saved. Photo id is", photo.id)
Novější Starší