mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
fix: returns existing seller profile request instead of 401
This commit is contained in:
parent
2f6403d296
commit
d9f01cc96c
@ -3,6 +3,7 @@ using comissions.app.api.Models.PortfolioModel;
|
|||||||
using ArtPlatform.Database;
|
using ArtPlatform.Database;
|
||||||
using ArtPlatform.Database.Entities;
|
using ArtPlatform.Database.Entities;
|
||||||
using comissions.app.api.Models.SellerProfile;
|
using comissions.app.api.Models.SellerProfile;
|
||||||
|
using comissions.app.api.Models.SellerProfileRequest;
|
||||||
using comissions.app.api.Services.Payment;
|
using comissions.app.api.Services.Payment;
|
||||||
using comissions.app.api.Services.Storage;
|
using comissions.app.api.Services.Storage;
|
||||||
using comissions.app.database;
|
using comissions.app.database;
|
||||||
@ -79,8 +80,8 @@ public class SellerProfileController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId);
|
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId);
|
||||||
if(sellerProfileRequest!=null)
|
if (sellerProfileRequest != null)
|
||||||
return BadRequest("Account has already requested to be a seller.");
|
return Ok(sellerProfileRequest.ToModel());
|
||||||
|
|
||||||
sellerProfileRequest = new SellerProfileRequest()
|
sellerProfileRequest = new SellerProfileRequest()
|
||||||
{
|
{
|
||||||
@ -91,7 +92,7 @@ public class SellerProfileController : Controller
|
|||||||
_dbContext.SellerProfileRequests.Add(sellerProfileRequest);
|
_dbContext.SellerProfileRequests.Add(sellerProfileRequest);
|
||||||
await _dbContext.SaveChangesAsync();
|
await _dbContext.SaveChangesAsync();
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize("read:seller-profile")]
|
[Authorize("read:seller-profile")]
|
||||||
[Route("{sellerServiceId:int}/Portfolio/{portfolioId:int}")]
|
[Route("{sellerServiceId:int}/Portfolio/{portfolioId:int}")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user