mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
fix: the request count check now only includes not declined or completed.
This commit is contained in:
parent
ca68c3173b
commit
e980855d17
@ -1064,14 +1064,14 @@ public class RequestsController : Controller
|
||||
public async Task<IActionResult> CreateRequest([FromBody] RequestCreateModel model)
|
||||
{
|
||||
var openRequests = await _dbContext.Requests
|
||||
.Where(x=>x.UserId==User.GetUserId())
|
||||
.Where(x=>x.UserId==User.GetUserId() && (x.Completed==false || x.Declined==false))
|
||||
.CountAsync();
|
||||
|
||||
var artist = await _dbContext.UserArtists.FirstOrDefaultAsync(x=>x.Id==model.ArtistId);
|
||||
if(artist==null)
|
||||
return NotFound("Artist not found.");
|
||||
|
||||
if(openRequests>3)
|
||||
if(openRequests>=3)
|
||||
return BadRequest("You can only have 3 open requests at a time.");
|
||||
var userId = User.GetUserId();
|
||||
var request = new Request()
|
||||
|
Loading…
x
Reference in New Issue
Block a user