46 lines
1.9 KiB
C#
46 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using PowderCoating.Core.Enums;
|
|
|
|
namespace PowderCoating.Application.Interfaces;
|
|
|
|
public interface IJobPhotoService
|
|
{
|
|
/// <summary>
|
|
/// Saves a job photo to filesystem using a GUID-based filename for security
|
|
/// Stores in [ContentRoot]/media/{companyId}/job-photos/{jobId}/{guid}.{ext}
|
|
/// </summary>
|
|
/// <param name="file">The photo file to upload</param>
|
|
/// <param name="jobId">The job's ID</param>
|
|
/// <param name="companyId">The company's ID</param>
|
|
/// <param name="caption">Optional caption/note for the photo</param>
|
|
/// <param name="photoType">Type of photo (Before, Progress, After, etc.)</param>
|
|
/// <returns>Tuple with success status, relative file path, and error message if any</returns>
|
|
Task<(bool Success, string FilePath, string ErrorMessage)> SaveJobPhotoAsync(
|
|
IFormFile file,
|
|
int jobId,
|
|
int companyId,
|
|
string? caption = null,
|
|
JobPhotoType photoType = JobPhotoType.Progress);
|
|
|
|
/// <summary>
|
|
/// Deletes a job photo from filesystem
|
|
/// </summary>
|
|
/// <param name="filePath">Relative path to the photo file</param>
|
|
/// <returns>Tuple with success status and error message if any</returns>
|
|
Task<(bool Success, string ErrorMessage)> DeleteJobPhotoAsync(string filePath);
|
|
|
|
/// <summary>
|
|
/// Gets a job photo
|
|
/// </summary>
|
|
/// <param name="filePath">Relative path to the photo</param>
|
|
/// <returns>Tuple with success status, file bytes, content type, and error message</returns>
|
|
Task<(bool Success, byte[] FileContent, string ContentType, string ErrorMessage)> GetJobPhotoAsync(string filePath);
|
|
|
|
/// <summary>
|
|
/// Checks if a job photo exists
|
|
/// </summary>
|
|
/// <param name="filePath">Relative path to the photo</param>
|
|
/// <returns>True if exists, false otherwise</returns>
|
|
Task<bool> JobPhotoExistsAsync(string filePath);
|
|
}
|