package db

import (
	"context"
	"youngee_b_api/model/gorm_model"
)

func CreateProjectPhoto(ctx context.Context, projectPhotos []gorm_model.ProjectPhoto) error {
	db := GetReadDB(ctx)
	err := db.Create(&projectPhotos).Error
	if err != nil {
		return err
	}
	return nil
}
func DeleteProjectPhotoByProjecttID(ctx context.Context, productID string) error {
	db := GetReadDB(ctx)
	err := db.Where("project_id = ?", productID).Delete(&gorm_model.ProjectPhoto{}).Error
	if err != nil {
		return err
	}
	return nil
}

func DeletePhotoUrl(ctx context.Context, photoUrl string) error {
	db := GetReadDB(ctx)
	err := db.Where("photo_url = ?", photoUrl).Delete(&gorm_model.YounggeeProductPhoto{}).Error
	if err != nil {
		return err
	}
	return nil
}
