✨ Site mode
This commit is contained in:
@@ -1,9 +1,25 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using Google.Api;
|
||||||
|
|
||||||
namespace DysonNetwork.Shared.Models;
|
namespace DysonNetwork.Shared.Models;
|
||||||
|
|
||||||
|
public enum PublicationSiteMode
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The fully managed mode which allow other server to handle all the requests
|
||||||
|
/// Including the rendering, data fetching etc. /// Very easy to use and efficient.
|
||||||
|
/// </summary>
|
||||||
|
FullyManaged,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The self-managed mode allows user to upload their own site assets and use the Solar Network Pages
|
||||||
|
/// as a static site hosting platform.
|
||||||
|
/// </summary>
|
||||||
|
SelfManaged
|
||||||
|
}
|
||||||
|
|
||||||
public class SnPublicationSite : ModelBase
|
public class SnPublicationSite : ModelBase
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; } = Guid.NewGuid();
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
@@ -11,34 +27,36 @@ public class SnPublicationSite : ModelBase
|
|||||||
[MaxLength(4096)] public string Name { get; set; } = null!;
|
[MaxLength(4096)] public string Name { get; set; } = null!;
|
||||||
[MaxLength(8192)] public string? Description { get; set; }
|
[MaxLength(8192)] public string? Description { get; set; }
|
||||||
|
|
||||||
|
public PublicationSiteMode Mode { get; set; } = PublicationSiteMode.FullyManaged;
|
||||||
public List<SnPublicationPage> Pages { get; set; } = [];
|
public List<SnPublicationPage> Pages { get; set; } = [];
|
||||||
|
|
||||||
public Guid PublisherId { get; set; }
|
public Guid PublisherId { get; set; }
|
||||||
[NotMapped] public SnPublisher Publisher { get; set; } = null!;
|
[NotMapped] public SnPublisher Publisher { get; set; } = null!;
|
||||||
public Guid AccountId { get; set; }
|
public Guid AccountId { get; set; }
|
||||||
// Preloaded via the remote services
|
|
||||||
[NotMapped] public SnAccount? Account { get; set; }
|
[NotMapped] public SnAccount? Account { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class PublicationPagePresets
|
public enum PublicationPageType
|
||||||
{
|
{
|
||||||
// Will told the Isolated Island to render according to prebuilt pages by us
|
/// <summary>
|
||||||
public const string Landing = "landing"; // Some kind of the mixed version of the profile and the posts
|
/// The HTML page type allows user adding a custom HTML page in the fully managed mode.
|
||||||
public const string Profile = "profile";
|
/// </summary>
|
||||||
public const string Posts = "posts";
|
HtmlPage,
|
||||||
|
/// <summary>
|
||||||
// Will told the Isolated Island to render according to the blocks to use custom stuff
|
/// The redirect mode allows user to create a shortcut for their own link.
|
||||||
public const string Custom = "custom";
|
/// such as example.solian.page/rickroll -- DyZ 301 -> youtube.com/...
|
||||||
|
/// </summary>
|
||||||
|
Redirect
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SnPublicationPage : ModelBase
|
public class SnPublicationPage : ModelBase
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; } = Guid.NewGuid();
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
|
||||||
[MaxLength(8192)] public string Preset { get; set; } = PublicationPagePresets.Landing;
|
public PublicationPageType Type { get; set; } = PublicationPageType.HtmlPage;
|
||||||
[MaxLength(8192)] public string Path { get; set; } = "/";
|
[MaxLength(8192)] public string Path { get; set; } = "/";
|
||||||
[Column(TypeName = "jsonb")] public Dictionary<string, object?> Config { get; set; } = new();
|
[Column(TypeName = "jsonb")] public Dictionary<string, object?> Config { get; set; } = new();
|
||||||
|
|
||||||
public Guid SiteId { get; set; }
|
public Guid SiteId { get; set; }
|
||||||
[JsonIgnore] public SnPublicationSite Site { get; set; } = null!;
|
[JsonIgnore] public SnPublicationSite Site { get; set; } = null!;
|
||||||
}
|
}
|
||||||
2
DysonNetwork.Zone/.gitignore
vendored
2
DysonNetwork.Zone/.gitignore
vendored
@@ -33,3 +33,5 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|||||||
|
|
||||||
# Finder (MacOS) folder config
|
# Finder (MacOS) folder config
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
SiteData
|
||||||
|
|||||||
150
DysonNetwork.Zone/Migrations/20251120134237_AddSiteMode.Designer.cs
generated
Normal file
150
DysonNetwork.Zone/Migrations/20251120134237_AddSiteMode.Designer.cs
generated
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using DysonNetwork.Zone;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using NodaTime;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DysonNetwork.Zone.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDatabase))]
|
||||||
|
[Migration("20251120134237_AddSiteMode")]
|
||||||
|
partial class AddSiteMode
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "9.0.11")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPublicationPage", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("id");
|
||||||
|
|
||||||
|
b.Property<Dictionary<string, object>>("Config")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb")
|
||||||
|
.HasColumnName("config");
|
||||||
|
|
||||||
|
b.Property<Instant>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("created_at");
|
||||||
|
|
||||||
|
b.Property<Instant?>("DeletedAt")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("deleted_at");
|
||||||
|
|
||||||
|
b.Property<string>("Path")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8192)
|
||||||
|
.HasColumnType("character varying(8192)")
|
||||||
|
.HasColumnName("path");
|
||||||
|
|
||||||
|
b.Property<Guid>("SiteId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("site_id");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("type");
|
||||||
|
|
||||||
|
b.Property<Instant>("UpdatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("updated_at");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_publication_pages");
|
||||||
|
|
||||||
|
b.HasIndex("SiteId")
|
||||||
|
.HasDatabaseName("ix_publication_pages_site_id");
|
||||||
|
|
||||||
|
b.ToTable("publication_pages", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPublicationSite", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("id");
|
||||||
|
|
||||||
|
b.Property<Guid>("AccountId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("account_id");
|
||||||
|
|
||||||
|
b.Property<Instant>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("created_at");
|
||||||
|
|
||||||
|
b.Property<Instant?>("DeletedAt")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("deleted_at");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasMaxLength(8192)
|
||||||
|
.HasColumnType("character varying(8192)")
|
||||||
|
.HasColumnName("description");
|
||||||
|
|
||||||
|
b.Property<int>("Mode")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("mode");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(4096)
|
||||||
|
.HasColumnType("character varying(4096)")
|
||||||
|
.HasColumnName("name");
|
||||||
|
|
||||||
|
b.Property<Guid>("PublisherId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("publisher_id");
|
||||||
|
|
||||||
|
b.Property<string>("Slug")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(4096)
|
||||||
|
.HasColumnType("character varying(4096)")
|
||||||
|
.HasColumnName("slug");
|
||||||
|
|
||||||
|
b.Property<Instant>("UpdatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("updated_at");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_publication_sites");
|
||||||
|
|
||||||
|
b.ToTable("publication_sites", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPublicationPage", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DysonNetwork.Shared.Models.SnPublicationSite", "Site")
|
||||||
|
.WithMany("Pages")
|
||||||
|
.HasForeignKey("SiteId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_publication_pages_publication_sites_site_id");
|
||||||
|
|
||||||
|
b.Navigation("Site");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPublicationSite", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Pages");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
DysonNetwork.Zone/Migrations/20251120134237_AddSiteMode.cs
Normal file
52
DysonNetwork.Zone/Migrations/20251120134237_AddSiteMode.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DysonNetwork.Zone.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddSiteMode : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "preset",
|
||||||
|
table: "publication_pages");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "mode",
|
||||||
|
table: "publication_sites",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "type",
|
||||||
|
table: "publication_pages",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "mode",
|
||||||
|
table: "publication_sites");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "type",
|
||||||
|
table: "publication_pages");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "preset",
|
||||||
|
table: "publication_pages",
|
||||||
|
type: "character varying(8192)",
|
||||||
|
maxLength: 8192,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,16 +50,14 @@ namespace DysonNetwork.Zone.Migrations
|
|||||||
.HasColumnType("character varying(8192)")
|
.HasColumnType("character varying(8192)")
|
||||||
.HasColumnName("path");
|
.HasColumnName("path");
|
||||||
|
|
||||||
b.Property<string>("Preset")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(8192)
|
|
||||||
.HasColumnType("character varying(8192)")
|
|
||||||
.HasColumnName("preset");
|
|
||||||
|
|
||||||
b.Property<Guid>("SiteId")
|
b.Property<Guid>("SiteId")
|
||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasColumnName("site_id");
|
.HasColumnName("site_id");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("type");
|
||||||
|
|
||||||
b.Property<Instant>("UpdatedAt")
|
b.Property<Instant>("UpdatedAt")
|
||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasColumnName("updated_at");
|
.HasColumnName("updated_at");
|
||||||
@@ -97,6 +95,10 @@ namespace DysonNetwork.Zone.Migrations
|
|||||||
.HasColumnType("character varying(8192)")
|
.HasColumnType("character varying(8192)")
|
||||||
.HasColumnName("description");
|
.HasColumnName("description");
|
||||||
|
|
||||||
|
b.Property<int>("Mode")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("mode");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(4096)
|
.HasMaxLength(4096)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using DysonNetwork.Shared.Registry;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Models = DysonNetwork.Shared.Models;
|
using Models = DysonNetwork.Shared.Models;
|
||||||
using PublicationPagePresets = DysonNetwork.Shared.Models.PublicationPagePresets;
|
|
||||||
|
|
||||||
namespace DysonNetwork.Zone.Publication;
|
namespace DysonNetwork.Zone.Publication;
|
||||||
|
|
||||||
@@ -15,10 +14,10 @@ public class PublicationSiteController(
|
|||||||
RemotePublisherService publisherService
|
RemotePublisherService publisherService
|
||||||
) : ControllerBase
|
) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("site/{slug}")]
|
[HttpGet("{pubName}/{slug}")]
|
||||||
public async Task<ActionResult<SnPublicationSite>> GetSite(string slug)
|
public async Task<ActionResult<SnPublicationSite>> GetSite(string pubName, string slug)
|
||||||
{
|
{
|
||||||
var site = await publicationService.GetSiteBySlug(slug);
|
var site = await publicationService.GetSiteBySlug(slug, pubName);
|
||||||
if (site == null)
|
if (site == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
return Ok(site);
|
return Ok(site);
|
||||||
@@ -71,6 +70,7 @@ public class PublicationSiteController(
|
|||||||
|
|
||||||
var site = new SnPublicationSite
|
var site = new SnPublicationSite
|
||||||
{
|
{
|
||||||
|
Mode = request.Mode,
|
||||||
Slug = request.Slug,
|
Slug = request.Slug,
|
||||||
Name = request.Name,
|
Name = request.Name,
|
||||||
Description = request.Description,
|
Description = request.Description,
|
||||||
@@ -106,12 +106,10 @@ public class PublicationSiteController(
|
|||||||
if (publisher == null) return NotFound();
|
if (publisher == null) return NotFound();
|
||||||
|
|
||||||
var site = await publicationService.GetSiteById(id);
|
var site = await publicationService.GetSiteById(id);
|
||||||
if (site == null)
|
if (site == null || site.PublisherId != publisher.Id)
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
if (site.PublisherId != publisher.Id)
|
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
|
site.Mode = request.Mode;
|
||||||
site.Slug = request.Slug;
|
site.Slug = request.Slug;
|
||||||
site.Name = request.Name;
|
site.Name = request.Name;
|
||||||
site.Description = request.Description ?? site.Description;
|
site.Description = request.Description ?? site.Description;
|
||||||
@@ -204,7 +202,7 @@ public class PublicationSiteController(
|
|||||||
|
|
||||||
var page = new SnPublicationPage
|
var page = new SnPublicationPage
|
||||||
{
|
{
|
||||||
Preset = request.Preset ?? PublicationPagePresets.Landing,
|
Type = request.Type,
|
||||||
Path = request.Path ?? "/",
|
Path = request.Path ?? "/",
|
||||||
Config = request.Config ?? new Dictionary<string, object?>(),
|
Config = request.Config ?? new Dictionary<string, object?>(),
|
||||||
SiteId = site.Id
|
SiteId = site.Id
|
||||||
@@ -239,7 +237,7 @@ public class PublicationSiteController(
|
|||||||
|
|
||||||
var accountId = Guid.Parse(currentUser.Id);
|
var accountId = Guid.Parse(currentUser.Id);
|
||||||
|
|
||||||
if (request.Preset != null) page.Preset = request.Preset;
|
page.Type = request.Type;
|
||||||
if (request.Path != null) page.Path = request.Path;
|
if (request.Path != null) page.Path = request.Path;
|
||||||
if (request.Config != null) page.Config = request.Config;
|
if (request.Config != null) page.Config = request.Config;
|
||||||
|
|
||||||
@@ -278,6 +276,7 @@ public class PublicationSiteController(
|
|||||||
|
|
||||||
public class PublicationSiteRequest
|
public class PublicationSiteRequest
|
||||||
{
|
{
|
||||||
|
public PublicationSiteMode Mode { get; set; }
|
||||||
[MaxLength(4096)] public string Slug { get; set; } = null!;
|
[MaxLength(4096)] public string Slug { get; set; } = null!;
|
||||||
[MaxLength(4096)] public string Name { get; set; } = null!;
|
[MaxLength(4096)] public string Name { get; set; } = null!;
|
||||||
[MaxLength(8192)] public string? Description { get; set; }
|
[MaxLength(8192)] public string? Description { get; set; }
|
||||||
@@ -285,7 +284,7 @@ public class PublicationSiteController(
|
|||||||
|
|
||||||
public class PublicationPageRequest
|
public class PublicationPageRequest
|
||||||
{
|
{
|
||||||
[MaxLength(8192)] public string? Preset { get; set; }
|
public PublicationPageType Type { get; set; }
|
||||||
[MaxLength(8192)] public string? Path { get; set; }
|
[MaxLength(8192)] public string? Path { get; set; }
|
||||||
public Dictionary<string, object?>? Config { get; set; }
|
public Dictionary<string, object?>? Config { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using DysonNetwork.Shared.Auth;
|
using DysonNetwork.Shared.Auth;
|
||||||
|
using DysonNetwork.Shared.Data;
|
||||||
using DysonNetwork.Shared.Models;
|
using DysonNetwork.Shared.Models;
|
||||||
using DysonNetwork.Shared.Registry;
|
using DysonNetwork.Shared.Registry;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -9,7 +10,8 @@ namespace DysonNetwork.Zone.Publication;
|
|||||||
public class PublicationSiteService(
|
public class PublicationSiteService(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
RemotePublisherService publisherService,
|
RemotePublisherService publisherService,
|
||||||
RemoteAccountService remoteAccounts
|
RemoteAccountService remoteAccounts,
|
||||||
|
RemotePublisherService remotePublishers
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
public async Task<SnPublicationSite?> GetSiteById(Guid id)
|
public async Task<SnPublicationSite?> GetSiteById(Guid id)
|
||||||
@@ -19,9 +21,18 @@ public class PublicationSiteService(
|
|||||||
.FirstOrDefaultAsync(s => s.Id == id);
|
.FirstOrDefaultAsync(s => s.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SnPublicationSite?> GetSiteBySlug(string slug)
|
public async Task<SnPublicationSite?> GetSiteBySlug(string slug, string? pubName = null)
|
||||||
{
|
{
|
||||||
|
Guid? pubId = null;
|
||||||
|
if (pubName != null)
|
||||||
|
{
|
||||||
|
var pub = await remotePublishers.GetPublisherByName(pubName);
|
||||||
|
if (pub == null) throw new InvalidOperationException("Publisher not found.");
|
||||||
|
pubId = pub.Id;
|
||||||
|
}
|
||||||
|
|
||||||
return await db.PublicationSites
|
return await db.PublicationSites
|
||||||
|
.If(pubId.HasValue, q => q.Where(s => s.PublisherId == pubId.Value))
|
||||||
.Include(s => s.Pages)
|
.Include(s => s.Pages)
|
||||||
.FirstOrDefaultAsync(s => s.Slug == slug);
|
.FirstOrDefaultAsync(s => s.Slug == slug);
|
||||||
}
|
}
|
||||||
@@ -39,7 +50,7 @@ public class PublicationSiteService(
|
|||||||
var perk = (await remoteAccounts.GetAccount(accountId)).PerkSubscription;
|
var perk = (await remoteAccounts.GetAccount(accountId)).PerkSubscription;
|
||||||
var perkLevel = perk is not null ? PerkSubscriptionPrivilege.GetPrivilegeFromIdentifier(perk.Identifier) : 0;
|
var perkLevel = perk is not null ? PerkSubscriptionPrivilege.GetPrivilegeFromIdentifier(perk.Identifier) : 0;
|
||||||
|
|
||||||
var maxSite = (perkLevel) switch
|
var maxSite = perkLevel switch
|
||||||
{
|
{
|
||||||
1 => 2,
|
1 => 2,
|
||||||
2 => 3,
|
2 => 3,
|
||||||
|
|||||||
@@ -13,5 +13,8 @@
|
|||||||
"KnownProxies": ["127.0.0.1", "::1"],
|
"KnownProxies": ["127.0.0.1", "::1"],
|
||||||
"Swagger": {
|
"Swagger": {
|
||||||
"PublicBasePath": "/zone"
|
"PublicBasePath": "/zone"
|
||||||
|
},
|
||||||
|
"Sites": {
|
||||||
|
"BasePath": "/SiteData"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user