mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
fix:page endpoint
This commit is contained in:
parent
b164c654ce
commit
407d72da9e
@ -104,7 +104,7 @@ public class ArtistController : Controller
|
|||||||
public async Task<IActionResult> GetArtistPage()
|
public async Task<IActionResult> GetArtistPage()
|
||||||
{
|
{
|
||||||
var userId = User.GetUserId();
|
var userId = User.GetUserId();
|
||||||
var Artist = await _dbContext.UserArtists.Include(x=>x.ArtistPageSettings).FirstOrDefaultAsync(Artist=>Artist.UserId==userId);
|
var Artist = await _dbContext.UserArtists.Include(x=>x.ArtistPageSettings).FirstOrDefaultAsync(artist=>artist.UserId==userId);
|
||||||
if(Artist==null)
|
if(Artist==null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
var result = Artist.ArtistPageSettings.ToModel();
|
var result = Artist.ArtistPageSettings.ToModel();
|
||||||
|
@ -2,6 +2,7 @@ using comissions.app.api.Models.Artist;
|
|||||||
using comissions.app.api.Models.PortfolioModel;
|
using comissions.app.api.Models.PortfolioModel;
|
||||||
using comissions.app.api.Services.Storage;
|
using comissions.app.api.Services.Storage;
|
||||||
using comissions.app.database;
|
using comissions.app.database;
|
||||||
|
using comissions.app.database.Entities;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@ -55,11 +56,61 @@ public class DiscoveryController : Controller
|
|||||||
.FirstOrDefaultAsync(x=>x.Name==sellerName.Replace('-', ' '));
|
.FirstOrDefaultAsync(x=>x.Name==sellerName.Replace('-', ' '));
|
||||||
if(seller==null)
|
if(seller==null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
|
if (seller.ArtistPageSettings == null)
|
||||||
|
{
|
||||||
|
var newSettings = new ArtistPageSettings()
|
||||||
|
{
|
||||||
|
ArtistId = seller.Id,
|
||||||
|
BackgroundColor = "rgb(126, 115, 115)",
|
||||||
|
HeaderColor = "rgb(194, 187, 187)",
|
||||||
|
HeaderTextSize = 5,
|
||||||
|
HeaderUseImage = false,
|
||||||
|
HeaderImageUrl = "",
|
||||||
|
DescriptionHeaderText = "",
|
||||||
|
DescriptionHeaderColor = "rgb(194, 187, 187)",
|
||||||
|
DescriptionHeaderSize = 3,
|
||||||
|
DescriptionHeaderUseImage = false,
|
||||||
|
DescriptionHeaderImageUrl = "",
|
||||||
|
DescriptionBackgroundColor = "rgb(103, 97, 97)",
|
||||||
|
DescriptionTextColor = "rgb(186, 186, 186)",
|
||||||
|
DescriptionTextSize = 1,
|
||||||
|
PortfolionHeaderText = "",
|
||||||
|
PortfolionHeaderColor = "rgb(194, 187, 187)",
|
||||||
|
PortfolionHeaderSize = 3,
|
||||||
|
PortfolionHeaderUseImage = false,
|
||||||
|
PortfolionHeaderImageUrl = "",
|
||||||
|
PortfolioBackgroundColor = "rgb(78, 73, 73)",
|
||||||
|
PortfolioMasonry = true,
|
||||||
|
PortfolioColumns = 3,
|
||||||
|
PortfolioEnabledScrolling = true,
|
||||||
|
PortfolioMaximumSize = 50,
|
||||||
|
RequestHeaderText = "",
|
||||||
|
RequestHeaderColor = "rgb(194, 187, 187)",
|
||||||
|
RequestHeaderSize = 3,
|
||||||
|
RequestHeaderUseImage = false,
|
||||||
|
RequestHeaderImageUrl = "",
|
||||||
|
RequestBackgroundColor = "rgb(103, 97, 97)",
|
||||||
|
RequestTermsColor = "rgb(194, 187, 187)",
|
||||||
|
RequestButtonBGColor = "rgb(101, 97, 97)",
|
||||||
|
RequestButtonTextColor = "rgb(194, 187, 187)",
|
||||||
|
RequestButtonHoverBGColor = "rgb(98, 98, 98)"
|
||||||
|
};
|
||||||
|
var dbSettings = _dbContext.ArtistPageSettings.Add(newSettings).Entity;
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
var result = dbSettings.ToModel();
|
||||||
|
result.Artist = seller.ToModel();
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
var result = seller.ArtistPageSettings.ToModel();
|
var result = seller.ArtistPageSettings.ToModel();
|
||||||
result.Artist = seller.ToModel();
|
result.Artist = seller.ToModel();
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("Artists/{sellerId:int}/Portfolio")]
|
[Route("Artists/{sellerId:int}/Portfolio")]
|
||||||
public async Task<IActionResult> GetArtistPortfolio(int sellerId, int offset = 0, int pageSize = 10)
|
public async Task<IActionResult> GetArtistPortfolio(int sellerId, int offset = 0, int pageSize = 10)
|
||||||
|
@ -8,7 +8,6 @@ public static class ArtistPageSettingsModelExtensions
|
|||||||
|
|
||||||
public static ArtistPageSettingsModel ToModel(this ArtistPageSettings sellerProfile)
|
public static ArtistPageSettingsModel ToModel(this ArtistPageSettings sellerProfile)
|
||||||
{
|
{
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(sellerProfile));
|
|
||||||
return new ArtistPageSettingsModel()
|
return new ArtistPageSettingsModel()
|
||||||
{
|
{
|
||||||
BackgroundColor = sellerProfile.BackgroundColor,
|
BackgroundColor = sellerProfile.BackgroundColor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user