mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
removed random strings in api
This commit is contained in:
parent
d9f01cc96c
commit
29fc36e612
@ -53,7 +53,7 @@ public class AdminOrdersController:ControllerBase
|
||||
.FirstOrDefaultAsync(x=>x.Id==orderId);
|
||||
|
||||
if (order == null)
|
||||
return NotFound("Order not found.");
|
||||
return NotFound();
|
||||
|
||||
return Ok(order);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class AdminSellersController:ControllerBase
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
|
||||
if (seller == null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
|
||||
return Ok(seller);
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class AdminSellersController:ControllerBase
|
||||
.FirstOrDefault(x=>x.Id==sellerId);
|
||||
|
||||
if (seller == null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
|
||||
var orders = await _dbContext.SellerServiceOrders.Where(x=>x.SellerId==sellerId).ToListAsync();
|
||||
return Ok(orders);
|
||||
@ -69,10 +69,10 @@ public class AdminSellersController:ControllerBase
|
||||
var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId);
|
||||
|
||||
if (seller == null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
|
||||
if (seller.Suspended)
|
||||
return BadRequest("Seller is already suspended.");
|
||||
return BadRequest();
|
||||
|
||||
seller.Suspended = true;
|
||||
seller.SuspendedDate = DateTime.UtcNow;
|
||||
@ -91,10 +91,10 @@ public class AdminSellersController:ControllerBase
|
||||
var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId);
|
||||
|
||||
if (seller == null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
|
||||
if (!seller.Suspended)
|
||||
return BadRequest("Seller is not suspended.");
|
||||
return BadRequest();
|
||||
|
||||
seller.Suspended = false;
|
||||
seller.SuspendedDate = null;
|
||||
@ -113,10 +113,10 @@ public class AdminSellersController:ControllerBase
|
||||
var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId);
|
||||
|
||||
if (seller == null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
|
||||
if (!seller.Suspended)
|
||||
return BadRequest("Seller is not suspended.");
|
||||
return BadRequest();
|
||||
|
||||
_dbContext.UserSellerProfiles.Remove(seller);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
@ -129,10 +129,10 @@ public class AdminSellersController:ControllerBase
|
||||
var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId);
|
||||
|
||||
if (seller == null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
|
||||
if (!seller.Suspended)
|
||||
return BadRequest("Seller is not suspended.");
|
||||
return BadRequest();
|
||||
|
||||
seller.Biography = biography;
|
||||
_dbContext.UserSellerProfiles.Update(seller);
|
||||
|
@ -43,7 +43,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
return Ok(user);
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.Include(x=>x.Orders).FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
return Ok(user.Orders);
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
user.Suspended = true;
|
||||
user.SuspendedDate = DateTime.UtcNow;
|
||||
@ -83,7 +83,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
user.Suspended = false;
|
||||
user.SuspendedDate = null;
|
||||
@ -101,7 +101,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
user.Banned = true;
|
||||
user.BannedDate = DateTime.UtcNow;
|
||||
@ -119,7 +119,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
user.Banned = false;
|
||||
user.BannedDate = null;
|
||||
@ -137,7 +137,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
user.DisplayName = displayName;
|
||||
_dbContext.Users.Update(user);
|
||||
@ -151,7 +151,7 @@ public class AdminUsersController:ControllerBase
|
||||
var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound("User not found.");
|
||||
return NotFound();
|
||||
|
||||
user.Biography = biography;
|
||||
_dbContext.Users.Update(user);
|
||||
|
@ -45,7 +45,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var result = seller.ToDiscoveryModel();
|
||||
return Ok(result);
|
||||
}
|
||||
@ -58,7 +58,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces
|
||||
.Where(x=>x.SellerProfileId==sellerId)
|
||||
.Skip(offset).Take(pageSize).ToListAsync();
|
||||
@ -74,7 +74,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces
|
||||
.Where(x=>x.SellerProfileId==sellerId)
|
||||
.CountAsync();
|
||||
@ -89,7 +89,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces
|
||||
.FirstOrDefaultAsync(x=>x.Id==portfolioId);
|
||||
if(sellerPortfolio==null)
|
||||
@ -107,7 +107,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerReviews = await _dbContext.SellerServiceOrderReviews
|
||||
.Where(x=>x.SellerService.SellerProfileId==sellerId)
|
||||
.Skip(offset).Take(pageSize).ToListAsync();
|
||||
@ -128,7 +128,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerReviews = await _dbContext.SellerServiceOrderReviews
|
||||
.Where(x=>x.SellerService.SellerProfileId==sellerId)
|
||||
.CountAsync();
|
||||
@ -154,7 +154,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerServices = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews)
|
||||
.Where(x=>x.SellerProfileId==sellerId && !x.Archived)
|
||||
@ -171,12 +171,12 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
var result = sellerService.ToModel();
|
||||
return Ok(result);
|
||||
}
|
||||
@ -189,7 +189,7 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerServices = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews)
|
||||
.Where(x=>x.SellerProfileId==sellerId && !x.Archived)
|
||||
@ -206,12 +206,12 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.PortfolioPieces)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
var result = sellerService.PortfolioPieces.Select(x=>x.ToModel()).ToList();
|
||||
return Ok(result);
|
||||
}
|
||||
@ -224,12 +224,12 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.PortfolioPieces)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
var result = sellerService.PortfolioPieces.Count;
|
||||
return Ok(result);
|
||||
}
|
||||
@ -242,12 +242,12 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.PortfolioPieces)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces
|
||||
.FirstOrDefaultAsync(x=>x.Id==portfolioId);
|
||||
if(sellerPortfolio==null)
|
||||
@ -265,12 +265,12 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews).ThenInclude(x=>x.Reviewer)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
var result = sellerService.Reviews.Select(x=> new DiscoveryReviewModel()
|
||||
{
|
||||
Rating = x.Rating,
|
||||
@ -288,12 +288,12 @@ public class DiscoveryController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews).ThenInclude(x=>x.Reviewer)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
var result = sellerService.Reviews.Count;
|
||||
return Ok(result);
|
||||
}
|
||||
|
@ -109,21 +109,21 @@ public class OrderController : Controller
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
return NotFound();
|
||||
if(seller.Suspended)
|
||||
return NotFound("Seller is suspended.");
|
||||
return NotFound();
|
||||
|
||||
var service = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(service==null)
|
||||
return NotFound("Service not found.");
|
||||
return NotFound();
|
||||
|
||||
if(service.Archived)
|
||||
return BadRequest("Service is archived.");
|
||||
return BadRequest();
|
||||
|
||||
if(_dbContext.SellerServiceOrders.Where(x=>x.BuyerId==userId && x.Status!=EnumOrderStatus.Completed && x.Status!=EnumOrderStatus.Declined).Count()>=3)
|
||||
return BadRequest("You already have an order in progress. There is a limit of three at a time.");
|
||||
return BadRequest();
|
||||
|
||||
var order = new SellerServiceOrder()
|
||||
{
|
||||
@ -152,11 +152,11 @@ public class OrderController : Controller
|
||||
.Include(x=>x.SellerService)
|
||||
.FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId);
|
||||
if(order==null)
|
||||
return NotFound("/Order not found.");
|
||||
return NotFound();
|
||||
if(order.BuyerId!=userId)
|
||||
return BadRequest("You are not the buyer of this order.");
|
||||
return BadRequest();
|
||||
if(order.Status==EnumOrderStatus.Completed)
|
||||
return BadRequest("/Order is not in a cancellable state.");
|
||||
return BadRequest();
|
||||
order.Status = EnumOrderStatus.Declined;
|
||||
order.EndDate = DateTime.UtcNow;
|
||||
order = _dbContext.SellerServiceOrders.Update(order).Entity;
|
||||
@ -177,13 +177,13 @@ public class OrderController : Controller
|
||||
.Include(x=>x.Seller)
|
||||
.FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId);
|
||||
if(order==null)
|
||||
return NotFound("/Order not found.");
|
||||
return NotFound();
|
||||
if(order.Seller.UserId!=userId)
|
||||
return BadRequest("You are not the seller of this order.");
|
||||
return BadRequest();
|
||||
if(order.Status==EnumOrderStatus.Completed)
|
||||
return BadRequest("/Order is already complete.");
|
||||
return BadRequest();
|
||||
if(order.Status!=EnumOrderStatus.WaitingForPayment)
|
||||
return BadRequest("/Order does not need to be paid for.");
|
||||
return BadRequest();
|
||||
if (order.PaymentUrl != null)
|
||||
return Ok(order.PaymentUrl);
|
||||
var url = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price);
|
||||
@ -205,13 +205,13 @@ public class OrderController : Controller
|
||||
.Include(x=>x.SellerService)
|
||||
.FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId);
|
||||
if(order==null)
|
||||
return NotFound("/Order not found.");
|
||||
return NotFound();
|
||||
if(order.BuyerId!=userId)
|
||||
return BadRequest("You are not the buyer of this order.");
|
||||
return BadRequest("");
|
||||
if(order.Status!=EnumOrderStatus.Completed)
|
||||
return BadRequest("/Order is not complete.");
|
||||
return BadRequest("");
|
||||
if(order.Reviews.Any(x=>x.SellerServiceOrderId==orderId))
|
||||
return BadRequest("/Order has already been reviewed.");
|
||||
return BadRequest("");
|
||||
var review = new SellerServiceOrderReview()
|
||||
{
|
||||
SellerServiceOrderId = orderId,
|
||||
|
@ -60,20 +60,20 @@ public class SellerOrderController : Controller
|
||||
var userId = User.GetUserId();
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x=>x.UserId==userId);
|
||||
if(seller==null)
|
||||
return NotFound("User it not a seller.");
|
||||
return NotFound();
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var order = await _dbContext.SellerServiceOrders
|
||||
.Include(x=>x.SellerService)
|
||||
.FirstOrDefaultAsync(x=>x.Id==orderId && x.Seller.UserId==userId);
|
||||
if(order==null)
|
||||
return NotFound("Order not found.");
|
||||
return NotFound();
|
||||
if(order.Status==EnumOrderStatus.Completed || order.Status== EnumOrderStatus.Declined)
|
||||
return BadRequest("Order is already complete.");
|
||||
return BadRequest();
|
||||
if(order.BuyerId!=userId)
|
||||
return BadRequest("You are not the buyer of this order.");
|
||||
return BadRequest();
|
||||
if(order.Status!=EnumOrderStatus.Completed && order.Status!= EnumOrderStatus.Declined)
|
||||
return BadRequest("Order is not in a cancellable state.");
|
||||
return BadRequest();
|
||||
order.Status = EnumOrderStatus.Declined;
|
||||
order.EndDate = DateTime.UtcNow;
|
||||
order = _dbContext.SellerServiceOrders.Update(order).Entity;
|
||||
@ -90,22 +90,22 @@ public class SellerOrderController : Controller
|
||||
var userId = User.GetUserId();
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x => x.UserId == userId);
|
||||
if (seller == null)
|
||||
return NotFound("User it not a seller.");
|
||||
return NotFound();
|
||||
if (seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var order = await _dbContext.SellerServiceOrders
|
||||
.Include(x => x.SellerService)
|
||||
.FirstOrDefaultAsync(x => x.Id == orderId && x.Seller.UserId == userId);
|
||||
if (order == null)
|
||||
return NotFound("Order not found.");
|
||||
return NotFound();
|
||||
if (order.Status == EnumOrderStatus.Completed || order.Status == EnumOrderStatus.Declined)
|
||||
return BadRequest("Order is already complete.");
|
||||
return BadRequest();
|
||||
if (order.BuyerId != userId)
|
||||
return BadRequest("You are not the buyer of this order.");
|
||||
return BadRequest();
|
||||
if (order.Status != EnumOrderStatus.PendingAcceptance)
|
||||
return BadRequest("Order has already been accepted.");
|
||||
return BadRequest();
|
||||
if (order.Status == EnumOrderStatus.Declined)
|
||||
return BadRequest("Order has already been declined.");
|
||||
return BadRequest();
|
||||
order.Status = EnumOrderStatus.WaitingForPayment;
|
||||
order = _dbContext.SellerServiceOrders.Update(order).Entity;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
@ -121,20 +121,20 @@ public class SellerOrderController : Controller
|
||||
var userId = User.GetUserId();
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x => x.UserId == userId);
|
||||
if (seller == null)
|
||||
return NotFound("User it not a seller.");
|
||||
return NotFound();
|
||||
if (seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var order = await _dbContext.SellerServiceOrders
|
||||
.Include(x => x.SellerService)
|
||||
.FirstOrDefaultAsync(x => x.Id == orderId && x.Seller.UserId == userId);
|
||||
if (order == null)
|
||||
return NotFound("Order not found.");
|
||||
return NotFound();
|
||||
if (order.Status == EnumOrderStatus.Completed || order.Status == EnumOrderStatus.Declined)
|
||||
return BadRequest("Order is already complete.");
|
||||
return BadRequest();
|
||||
if (order.BuyerId != userId)
|
||||
return BadRequest("You are not the buyer of this order.");
|
||||
return BadRequest();
|
||||
if (order.Status != EnumOrderStatus.PendingAcceptance)
|
||||
return BadRequest("Order has already been accepted or declined.");
|
||||
return BadRequest();
|
||||
order.Status = EnumOrderStatus.Declined;
|
||||
order = _dbContext.SellerServiceOrders.Update(order).Entity;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
@ -155,19 +155,19 @@ public class SellerOrderController : Controller
|
||||
.FirstOrDefaultAsync(x=>x.Id==orderId && x.Seller.UserId==userId);
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x=>x.UserId==userId);
|
||||
if(seller==null)
|
||||
return NotFound("User it not a seller.");
|
||||
return NotFound();
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
if(order==null)
|
||||
return NotFound("Order not found.");
|
||||
return NotFound();
|
||||
if(order.Seller.UserId!=userId)
|
||||
return BadRequest("You are not the seller of this order.");
|
||||
return BadRequest();
|
||||
if(order.Status==EnumOrderStatus.Completed || order.Status== EnumOrderStatus.Declined)
|
||||
return BadRequest("Order is already complete.");
|
||||
return BadRequest();
|
||||
if(order.Status<EnumOrderStatus.InProgress)
|
||||
return BadRequest("Order has not been started.");
|
||||
return BadRequest();
|
||||
if(order.Status>EnumOrderStatus.InProgress)
|
||||
return BadRequest("Order is pending review already.");
|
||||
return BadRequest();
|
||||
order.Status = EnumOrderStatus.Completed;
|
||||
order = _dbContext.SellerServiceOrders.Update(order).Entity;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
@ -40,8 +40,8 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
var result = sellerProfile.ToModel();
|
||||
return Ok(result);
|
||||
@ -57,8 +57,8 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
var updatedSellerProfile = model.ToModel(existingSellerProfile);
|
||||
updatedSellerProfile = _dbContext.UserSellerProfiles.Update(updatedSellerProfile).Entity;
|
||||
@ -76,7 +76,7 @@ public class SellerProfileController : Controller
|
||||
var existingSellerProfile = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId);
|
||||
if (existingSellerProfile != null)
|
||||
{
|
||||
return Unauthorized("Account is already a seller.");
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId);
|
||||
@ -104,11 +104,11 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var portfolio = await _dbContext.SellerProfilePortfolioPieces
|
||||
.FirstAsync(x => x.SellerProfileId == existingSellerProfile.Id && x.Id==portfolioId);
|
||||
@ -127,11 +127,11 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var portfolio = await _dbContext.SellerProfilePortfolioPieces.Where(x=>x.SellerProfileId==existingSellerProfile.Id).ToListAsync();
|
||||
var result = portfolio.Select(x=>x.ToModel()).ToList();
|
||||
return Ok(result);
|
||||
@ -148,12 +148,12 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var url = await _storageService.UploadImageAsync(file, Guid.NewGuid().ToString());
|
||||
var portfolio = new SellerProfilePortfolioPiece()
|
||||
{
|
||||
@ -178,16 +178,16 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var portfolio = await _dbContext.SellerProfilePortfolioPieces.FirstOrDefaultAsync(x=>x.Id==portfolioId);
|
||||
if(portfolio==null)
|
||||
return NotFound("Portfolio piece not found.");
|
||||
return NotFound();
|
||||
if(portfolio.SellerProfileId!=existingSellerProfile.Id)
|
||||
return BadRequest("Portfolio piece does not belong to this seller.");
|
||||
return BadRequest();
|
||||
_dbContext.SellerProfilePortfolioPieces.Remove(portfolio);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return Ok();
|
||||
@ -204,14 +204,14 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
if(existingSellerProfile.StripeAccountId!=null)
|
||||
return BadRequest("Account already have a payment account.");
|
||||
return BadRequest();
|
||||
|
||||
var accountId = _paymentService.CreateSellerAccount();
|
||||
existingSellerProfile.StripeAccountId = accountId;
|
||||
@ -232,13 +232,13 @@ public class SellerProfileController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
if(existingSellerProfile.StripeAccountId==null)
|
||||
return BadRequest("Account does not have a payment account.");
|
||||
return BadRequest();
|
||||
|
||||
var result = _paymentService.CreateSellerAccountOnboardingUrl(existingSellerProfile.StripeAccountId);
|
||||
return Ok(result);
|
||||
|
@ -36,10 +36,10 @@ public class SellerServiceController : Controller
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId);
|
||||
|
||||
if(seller==null)
|
||||
return BadRequest("Account is not a seller.");
|
||||
return BadRequest();
|
||||
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var sellerServices = await _dbContext.SellerServices.Where(x=>x.Archived==false).Include(x=>x.Reviews)
|
||||
.Skip(offset).Take(pageSize).ToListAsync();
|
||||
@ -56,10 +56,10 @@ public class SellerServiceController : Controller
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId);
|
||||
|
||||
if(seller==null)
|
||||
return BadRequest("Account is not a seller.");
|
||||
return BadRequest();
|
||||
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var sellerServices = await _dbContext.SellerServices.Where(x=>x.Archived==false).Include(x => x.Reviews).ToListAsync();
|
||||
var result = sellerServices.Count;
|
||||
@ -74,16 +74,16 @@ public class SellerServiceController : Controller
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId);
|
||||
|
||||
if(seller==null)
|
||||
return BadRequest("Account is not a seller.");
|
||||
return BadRequest();
|
||||
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
if(seller.StripeAccountId==null)
|
||||
return BadRequest("Account does not have a payment account.");
|
||||
return BadRequest();
|
||||
|
||||
if (_paymentService.SellerAccountIsOnboarded(seller.StripeAccountId) == false)
|
||||
return BadRequest("Account has not finished onboarding.");
|
||||
return BadRequest();
|
||||
|
||||
var sellerService = new SellerService()
|
||||
{
|
||||
@ -107,15 +107,15 @@ public class SellerServiceController : Controller
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId);
|
||||
|
||||
if(seller==null)
|
||||
return BadRequest("Account is not a seller.");
|
||||
return BadRequest();
|
||||
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var sellerService = await _dbContext.SellerServices.FirstOrDefaultAsync(sellerService=>sellerService.Id==sellerServiceId);
|
||||
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
|
||||
sellerService.Name = model.Name;
|
||||
sellerService.Description = model.Description;
|
||||
@ -136,15 +136,15 @@ public class SellerServiceController : Controller
|
||||
var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId);
|
||||
|
||||
if(seller==null)
|
||||
return BadRequest("Account is not a seller.");
|
||||
return BadRequest();
|
||||
|
||||
if(seller.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var sellerService = await _dbContext.SellerServices.FirstOrDefaultAsync(sellerService=>sellerService.Id==sellerServiceId);
|
||||
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
return NotFound();
|
||||
|
||||
sellerService.Archived = true;
|
||||
_dbContext.SellerServices.Update(sellerService);
|
||||
@ -164,11 +164,11 @@ public class SellerServiceController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var portfolio = await _dbContext.SellerProfilePortfolioPieces.Where(x=>x.SellerProfileId==existingSellerProfile.Id && x.SellerServiceId==sellerServiceId).ToListAsync();
|
||||
var result = portfolio.Select(x=>x.ToModel()).ToList();
|
||||
return Ok(result);
|
||||
@ -186,12 +186,12 @@ public class SellerServiceController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var portfolio = await _dbContext.SellerProfilePortfolioPieces
|
||||
.FirstAsync(x => x.SellerProfileId == existingSellerProfile.Id
|
||||
@ -211,12 +211,12 @@ public class SellerServiceController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
|
||||
var url = await _storageService.UploadImageAsync(file, Guid.NewGuid().ToString());
|
||||
var portfolio = new SellerProfilePortfolioPiece()
|
||||
@ -243,16 +243,16 @@ public class SellerServiceController : Controller
|
||||
{
|
||||
var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false);
|
||||
if(sellerProfileRequest!=null)
|
||||
return BadRequest("Account has requested to be a seller and not been approved yet.");
|
||||
return Unauthorized("Account is not a seller.");
|
||||
return BadRequest();
|
||||
return Unauthorized();
|
||||
}
|
||||
if(existingSellerProfile.Suspended)
|
||||
return BadRequest("Seller is suspended.");
|
||||
return BadRequest();
|
||||
var portfolio = await _dbContext.SellerProfilePortfolioPieces.FirstOrDefaultAsync(x=>x.Id==portfolioId);
|
||||
if(portfolio==null)
|
||||
return NotFound("Portfolio piece not found.");
|
||||
return NotFound();
|
||||
if(portfolio.SellerProfileId!=existingSellerProfile.Id)
|
||||
return BadRequest("Portfolio piece does not belong to this seller.");
|
||||
return BadRequest();
|
||||
_dbContext.SellerProfilePortfolioPieces.Remove(portfolio);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return Ok();
|
||||
|
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("comissions.app.database.migrator")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+39c13a24ce87e41d0a98d64f71a8873e6e0fb7f2")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d9f01cc96c3f3488ff1ffabc8c18ff2ed9192d31")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("comissions.app.database.migrator")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("comissions.app.database.migrator")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
17d901dc318786e00800140359f2c1fd4726c24e195f53230c47f722959e350f
|
||||
c6d58bbb171a5f23ad416c7cc86ea9dc93efccc8a6b6525298ad1e8fa000718c
|
||||
|
@ -1 +1 @@
|
||||
17076145079561012
|
||||
17077084151680581
|
Loading…
x
Reference in New Issue
Block a user