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()
|
||||
{
|
||||
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)
|
||||
return NotFound();
|
||||
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.Services.Storage;
|
||||
using comissions.app.database;
|
||||
using comissions.app.database.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@ -55,9 +56,59 @@ public class DiscoveryController : Controller
|
||||
.FirstOrDefaultAsync(x=>x.Name==sellerName.Replace('-', ' '));
|
||||
if(seller==null)
|
||||
return NotFound();
|
||||
var result = seller.ArtistPageSettings.ToModel();
|
||||
result.Artist = seller.ToModel();
|
||||
return Ok(result);
|
||||
|
||||
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();
|
||||
result.Artist = seller.ToModel();
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
@ -8,7 +8,6 @@ public static class ArtistPageSettingsModelExtensions
|
||||
|
||||
public static ArtistPageSettingsModel ToModel(this ArtistPageSettings sellerProfile)
|
||||
{
|
||||
Console.WriteLine(JsonConvert.SerializeObject(sellerProfile));
|
||||
return new ArtistPageSettingsModel()
|
||||
{
|
||||
BackgroundColor = sellerProfile.BackgroundColor,
|
||||
|
Loading…
x
Reference in New Issue
Block a user