save both relations {typeorm}

Let's save a photo, and its metadata and attach them to each other.

const photo = new Photo();
const metadata = new PhotoMetadata();
...
// get entity relationships
const photoRepository = AppDataSource.getRepository(Photo);
const metadataRepository = AppDataSource.getRepository(PhotoMetadata);

// first we should save a photo
await photoRepository.save(photo);

// photo is saved. Now we need to save a photo metadata
await metadataRepository.save(metadata);