namespace SafeCampus.Application.Services.Business.PersonFacesService;

public class PersonFacesService:DbRepository<PersonFaces>, IPersonFacesService
{
    public async Task<bool> BatchAdd(List<PersonFaces> list)
    {
        var oldList = await GetListAsync(x => x.PersonId == list[0].PersonId);
        await DeleteAsync(oldList);
        await InsertRangeAsync(list);
        return true;
    }

    public async Task<bool> Add(PersonFaces entity)
    {
        await InsertAsync(entity);
        return true;
    }

    public async Task<bool> Delete(string personId, List<string> faceIds)
    {
        var delList = await GetListAsync(x => x.PersonId == personId && faceIds.Contains(x.FaceId));
        await DeleteAsync(delList);
        return true;
    }
}