mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-07 04:18:38 +00:00
No longer allow duplicate photos
This commit is contained in:
parent
52b4cc8ada
commit
69ae0d30ec
1 changed files with 8 additions and 0 deletions
|
@ -42,6 +42,14 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
Photo? photo = (Photo?)serializer.Deserialize(new StringReader(bodyString));
|
||||
if (photo == null) return this.BadRequest();
|
||||
|
||||
foreach (Photo p in this.database.Photos.Where(p => p.CreatorId == user.UserId))
|
||||
{
|
||||
if (p.LargeHash == photo.LargeHash) return this.Ok(); // photo already uplaoded
|
||||
if (p.MediumHash == photo.MediumHash) return this.Ok();
|
||||
if (p.SmallHash == photo.SmallHash) return this.Ok();
|
||||
if (p.PlanHash == photo.PlanHash) return this.Ok();
|
||||
}
|
||||
|
||||
photo.CreatorId = user.UserId;
|
||||
photo.Creator = user;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue