upgrading RSecurityBackend

This commit is contained in:
Hamid Reza Mohammadi 2025-01-25 16:59:57 +03:30
parent 2099633429
commit 74d621dd26
10 changed files with 6057 additions and 12 deletions

View File

@ -50,7 +50,7 @@ namespace RMuseum.Controllers
var l = res.Result;
bool keepHistory = false;
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id);
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id, null);
if (!string.IsNullOrEmpty(kRes.Result))
bool.TryParse(kRes.Result, out keepHistory);
@ -92,7 +92,7 @@ namespace RMuseum.Controllers
var l = res.Result;
bool keepHistory = false;
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id);
var kRes = await _optionsService.GetValueAsync("KeepHistory", l.User.Id, null);
if (!string.IsNullOrEmpty(kRes.Result))
bool.TryParse(kRes.Result, out keepHistory);

View File

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using RSecurityBackend.Controllers;
using RSecurityBackend.Services;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
/// <inheritdoc />
public partial class WorkspaceGenericOptions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "WorkspaceId",
table: "Options",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Options_WorkspaceId",
table: "Options",
column: "WorkspaceId");
migrationBuilder.AddForeignKey(
name: "FK_Options_RWorkspaces_WorkspaceId",
table: "Options",
column: "WorkspaceId",
principalTable: "RWorkspaces",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Options_RWorkspaces_WorkspaceId",
table: "Options");
migrationBuilder.DropIndex(
name: "IX_Options_WorkspaceId",
table: "Options");
migrationBuilder.DropColumn(
name: "WorkspaceId",
table: "Options");
}
}
}

View File

@ -17,7 +17,7 @@ namespace RMuseum.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.0")
.HasAnnotation("ProductVersion", "9.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@ -4400,8 +4400,13 @@ namespace RMuseum.Migrations
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("WorkspaceId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("WorkspaceId");
b.HasIndex("RAppUserId", "Name")
.IsUnique()
.HasFilter("[RAppUserId] IS NOT NULL AND [Name] IS NOT NULL");
@ -5839,7 +5844,13 @@ namespace RMuseum.Migrations
.WithMany()
.HasForeignKey("RAppUserId");
b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", "Workspace")
.WithMany()
.HasForeignKey("WorkspaceId");
b.Navigation("RAppUser");
b.Navigation("Workspace");
});
modelBuilder.Entity("RSecurityBackend.Models.Notification.RUserNotification", b =>

View File

@ -19,15 +19,15 @@
<ItemGroup>
<PackageReference Include="Betalgo.Ranul.OpenAI" Version="9.0.1" />
<PackageReference Include="DNTPersianUtils.Core" Version="6.3.2" />
<PackageReference Include="DNTPersianUtils.Core" Version="6.4.0" />
<PackageReference Include="FluentFTP" Version="52.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NAudio" Version="2.2.1" />
<PackageReference Include="RSecurityBackend" Version="1.5.4" />
<PackageReference Include="RSecurityBackend" Version="1.5.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />

View File

@ -4319,6 +4319,18 @@
<member name="M:RMuseum.Migrations.LimitedFieldLengths1.BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder)">
<inheritdoc />
</member>
<member name="T:RMuseum.Migrations.LimitFieldLengths">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.LimitFieldLengths.Up(Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder)">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.LimitFieldLengths.Down(Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder)">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.LimitFieldLengths.BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder)">
<inheritdoc />
</member>
<member name="T:RMuseum.Models.Accounting.DonationExpenditure">
<summary>
donation expenditures

View File

@ -77,7 +77,7 @@ namespace RMuseum.Services.Implementation
int lastFinishedPoetId = 0;
if (!reset)
{
var resOption = await _optionsService.GetValueAsync("CategoryWordCountsLastPoetId", null);
var resOption = await _optionsService.GetValueAsync("CategoryWordCountsLastPoetId", null, null);
if (!string.IsNullOrEmpty(resOption.Result))
{
lastFinishedPoetId = int.Parse(resOption.Result);

View File

@ -1040,7 +1040,7 @@ namespace RMuseum.Services.Implementation
}
PublishStatus status = PublishStatus.Published;
var keepFirstTimeUsersComments = await _optionsService.GetValueAsync("KeepFirstTimeUsersComments", null);
var keepFirstTimeUsersComments = await _optionsService.GetValueAsync("KeepFirstTimeUsersComments", null, null);
if (keepFirstTimeUsersComments.Result == true.ToString())
{
if ((await _context.GanjoorComments.AsNoTracking().Where(c => c.UserId == userId && c.Status == PublishStatus.Published).AnyAsync()) == false)//First time commenter

View File

@ -26,7 +26,7 @@ namespace RMuseum.Services.Implementation
public async Task<RServiceResult<bool>> AddAsync(Guid userId, int poemId)
{
bool keepHistory = false;
var kRes = await _optionsService.GetValueAsync("KeepHistory", userId);
var kRes = await _optionsService.GetValueAsync("KeepHistory", userId, null);
if (!string.IsNullOrEmpty(kRes.Result))
bool.TryParse(kRes.Result, out keepHistory);
if (!keepHistory)
@ -75,7 +75,7 @@ namespace RMuseum.Services.Implementation
/// <returns></returns>
public async Task<RServiceResult<bool>> SwitchTrackingAsync(Guid userId, bool start)
{
var res = await _optionsService.SetAsync("KeepHistory", start.ToString(), userId);
var res = await _optionsService.SetAsync("KeepHistory", start.ToString(), userId, null);
if (!string.IsNullOrEmpty(res.ExceptionString))
return new RServiceResult<bool>(false, res.ExceptionString);
if(!start)