Refactor script results and move entities.

This commit is contained in:
Jared Goodwin 2023-07-26 15:56:24 -07:00
parent 9bf53192da
commit aa11983acf
65 changed files with 80 additions and 53 deletions

View File

@ -4,8 +4,8 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Remotely.Shared;
using Remotely.Shared.Dtos;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Net.Http;

View File

@ -4,8 +4,8 @@ using Immense.RemoteControl.Shared;
using Immense.RemoteControl.Shared.Models;
using Microsoft.Extensions.Logging;
using Remotely.Shared;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Services;
using Remotely.Shared.Utilities;
using System;

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Build.Framework;
using Microsoft.Extensions.Logging;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging;
using Remotely.Server.Auth;
using Remotely.Server.Extensions;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using System;
using System.Collections.Generic;

View File

@ -8,7 +8,7 @@ using Microsoft.Extensions.Logging;
using Remotely.Server.Hubs;
using Remotely.Server.Models;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Linq;
using System.Threading.Tasks;

View File

@ -11,6 +11,7 @@ using Org.BouncyCastle.Crypto.Agreement;
using Remotely.Server.Auth;
using Remotely.Server.Extensions;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using Remotely.Shared.ViewModels;
using System;

View File

@ -4,7 +4,6 @@ using Microsoft.AspNetCore.SignalR;
using Remotely.Server.Hubs;
using Remotely.Server.Models;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using System;
using System.Linq;
using System.Threading.Tasks;
@ -14,6 +13,7 @@ using Immense.RemoteControl.Server.Abstractions;
using Immense.RemoteControl.Shared.Helpers;
using Microsoft.Extensions.Logging;
using Remotely.Server.Extensions;
using Remotely.Shared.Entities;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

View File

@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Remotely.Server.Auth;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -4,7 +4,6 @@ using Microsoft.AspNetCore.SignalR;
using Remotely.Server.Hubs;
using Remotely.Server.Services;
using Remotely.Shared.Utilities;
using Remotely.Shared.Models;
using System;
using System.IO;
using System.Threading.Tasks;
@ -13,6 +12,7 @@ using Remotely.Server.Auth;
using Immense.RemoteControl.Shared.Helpers;
using Remotely.Shared;
using Remotely.Server.Extensions;
using Remotely.Shared.Entities;
namespace Remotely.Server.API;

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
namespace Remotely.Server.Areas.Identity.Pages.Account;

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
namespace Remotely.Server.Areas.Identity.Pages.Account;

View File

@ -10,9 +10,9 @@ using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using Remotely.Shared.Models;
using Remotely.Server.Services;
using Microsoft.Extensions.Logging;
using Remotely.Shared.Entities;
namespace Remotely.Server.Areas.Identity.Pages.Account;

View File

@ -11,10 +11,10 @@ using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Remotely.Shared.Models;
using Remotely.Server.Services;
using Microsoft.AspNetCore.WebUtilities;
using System.Text;
using Remotely.Shared.Entities;
namespace Remotely.Server.Areas.Identity.Pages.Account;

View File

@ -4,6 +4,7 @@
@using Microsoft.AspNetCore.SignalR
@using Remotely.Server.Hubs
@using Immense.RemoteControl.Server.Hubs
@using Remotely.Shared.Entities
@attribute [IgnoreAntiforgeryToken]
@inject SignInManager<RemotelyUser> SignInManager

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
namespace Remotely.Server.Areas.Identity.Pages.Account.Manage;

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
namespace Remotely.Server.Areas.Identity.Pages.Account.Manage;

View File

@ -1,2 +1,3 @@
@using Remotely.Server.Areas.Identity.Pages.Account.Manage
@using Remotely.Shared.Models
@using Remotely.Shared.Models
@using Remotely.Shared.Entities

View File

@ -17,6 +17,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Remotely.Server.Services;
using Remotely.Shared;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
namespace Remotely.Server.Areas.Identity.Pages.Account;

View File

@ -1,4 +1,5 @@
@using Microsoft.AspNetCore.Identity
@using Remotely.Shared.Entities
@inject SignInManager<RemotelyUser> SignInManager
@inject UserManager<RemotelyUser> UserManager
@inject Remotely.Server.Services.IApplicationConfig AppConfig

View File

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System.Threading.Tasks;
namespace Remotely.Server.Auth;

View File

@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System.Threading.Tasks;
namespace Remotely.Server.Auth;

View File

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Identity;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

View File

@ -9,6 +9,7 @@ using Remotely.Server.Enums;
using Remotely.Server.Hubs;
using Remotely.Server.Models;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;

View File

@ -7,6 +7,7 @@ using Remotely.Server.Hubs;
using Remotely.Server.Models;
using Remotely.Server.Services;
using Remotely.Shared.Attributes;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;

View File

@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging;
using Remotely.Server.Components.ModalContents;
using Remotely.Server.Hubs;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;

View File

@ -8,6 +8,7 @@ using Remotely.Server.Migrations.Sqlite;
using Remotely.Server.Migrations.SqlServer;
using Remotely.Server.Pages;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components.Forms;
using Microsoft.CodeAnalysis.Scripting;
using Remotely.Server.Pages;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Remotely.Server.Pages;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;

View File

@ -1,5 +1,5 @@
using Remotely.Server.Components.TreeView;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;

View File

@ -6,6 +6,7 @@ using Remotely.Server.Models;
using Remotely.Server.Services;
using Remotely.Shared;
using Remotely.Shared.Dtos;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
@ -278,7 +279,7 @@ public class AgentHub : Hub
_ = await _circuitManager.InvokeOnConnection($"{result.Value.SenderConnectionID}",
CircuitEventName.ScriptResult,
result);
result.Value);
}
public void ScriptResultViaApi(string commandID, string requestID)

View File

@ -12,8 +12,8 @@ using Remotely.Server.Auth;
using Remotely.Server.Models;
using Remotely.Server.Services;
using Remotely.Shared;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Concurrent;

View File

@ -1,5 +1,6 @@
@page "/api-keys"
@using Immense.RemoteControl.Shared.Helpers;
@using Remotely.Shared.Entities;
@attribute [Authorize(Policy = PolicyNames.OrganizationAdminRequired)]
@inherits AuthComponentBase

View File

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Components.Web;
using Remotely.Server.Components;
using Remotely.Server.Hubs;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Concurrent;

View File

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.WebUtilities;
using Remotely.Server.Components;
using Remotely.Server.Components.ModalContents;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using Remotely.Shared.ViewModels;
using System;

View File

@ -9,8 +9,8 @@ using Microsoft.Extensions.Logging;
using Remotely.Server.Components;
using Remotely.Server.Hubs;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -3,6 +3,7 @@
@using Microsoft.EntityFrameworkCore;
@using Remotely.Server.Services
@using Remotely.Shared.Models
@using Remotely.Shared.Entities
@inject IApplicationConfig AppConfig
@inject IWebHostEnvironment Environment
@inject ICompositeViewEngine Engine

View File

@ -1,6 +1,6 @@
@using Microsoft.AspNetCore.Identity
@using Remotely.Shared.Models
@using Remotely.Shared.Entities
@inject SignInManager<RemotelyUser> SignInManager
@inject UserManager<RemotelyUser> UserManager
@inject Remotely.Server.Services.IApplicationConfig AppConfig

View File

@ -1,6 +1,7 @@
@page "/"
@using Remotely.Server.Services
@using Remotely.Shared.Models
@using Remotely.Shared.Entities
@namespace Remotely.Server.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@inject IDataService DataService

View File

@ -23,7 +23,6 @@ using Remotely.Server.Auth;
using Remotely.Server.Data;
using Remotely.Server.Hubs;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using System.IO;
using System.Linq;
using System.Net;
@ -39,6 +38,7 @@ using Serilog;
using Nihs.SimpleMessenger;
using Microsoft.AspNetCore.RateLimiting;
using RatePolicyNames = Remotely.Server.RateLimiting.PolicyNames;
using Remotely.Shared.Entities;
var builder = WebApplication.CreateBuilder(args);
var configuration = builder.Configuration;

View File

@ -1,5 +1,5 @@
using Immense.RemoteControl.Server.Models;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

View File

@ -1,7 +1,7 @@
using Immense.RemoteControl.Shared;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -12,6 +12,7 @@ using Remotely.Server.Data;
using Remotely.Server.Models;
using Remotely.Shared;
using Remotely.Shared.Dtos;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;

View File

@ -1,8 +1,8 @@
using Immense.RemoteControl.Server.Abstractions;
using Microsoft.Extensions.Logging;
using Remotely.Server.Hubs;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Generic;

View File

@ -23,4 +23,5 @@
@using System.Collections.Concurrent
@using Remotely.Server.Components.Scripts
@using Remotely.Server.Components.TreeView
@using Remotely.Server.Auth
@using Remotely.Server.Auth
@using Remotely.Shared.Entities

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class Alert
{

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class ApiToken
{

View File

@ -9,15 +9,15 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class BrandingInfo : BrandingInfoBase
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; } = string.Empty;
public string Id { get; set; } = null!;
public string? OrganizationId { get; set; }
public string OrganizationId { get; set; } = null!;
[JsonIgnore]
public Organization? Organization { get; set; }

View File

@ -1,5 +1,6 @@
using Remotely.Shared.Attributes;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -7,7 +8,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.InteropServices;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class Device
{
@ -40,7 +41,7 @@ public class Device
public List<Drive>? Drives { get; set; }
[Key]
public string ID { get; set; } = null!;
public string ID { get; set; } = Guid.NewGuid().ToString();
public bool Is64Bit { get; set; }
public bool IsOnline { get; set; }
@ -54,7 +55,7 @@ public class Device
public string[] MacAddresses { get; set; } = Array.Empty<string>();
[StringLength(5000)]
public string? Notes { get; set; }
public string? Notes { get; set; }
[JsonIgnore]
public Organization? Organization { get; set; }

View File

@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class InviteLink
{
@ -15,6 +15,6 @@ public class InviteLink
public DateTimeOffset DateSent { get; set; }
[JsonIgnore]
public Organization? Organization { get; set; }
public string? OrganizationID { get; set; }
public string OrganizationID { get; set; } = null!;
public string? ResetUrl { get; set; }
}

View File

@ -1,11 +1,12 @@
using Immense.RemoteControl.Shared.Models;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class Organization
{

View File

@ -1,9 +1,10 @@
using Microsoft.AspNetCore.Identity;
using Remotely.Shared.Models;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class RemotelyUser : IdentityUser
{

View File

@ -8,7 +8,7 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class SavedScript
{

View File

@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class ScriptResult : ScriptResultBase
{
@ -17,12 +17,12 @@ public class ScriptResult : ScriptResultBase
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string ID { get; set; } = string.Empty;
public string ID { get; set; } = null!;
[JsonIgnore]
[IgnoreDataMember]
public Organization? Organization { get; set; }
public string OrganizationID { get; set; } = string.Empty;
public required string OrganizationID { get; set; }
[JsonIgnore]
public SavedScript? SavedScript { get; set; }

View File

@ -8,7 +8,7 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class ScriptRun
{

View File

@ -1,4 +1,5 @@
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Generic;
@ -9,7 +10,7 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class ScriptSchedule
{

View File

@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Remotely.Shared.Models;
namespace Remotely.Shared.Entities;
public class SharedFile
{

View File

@ -1,5 +1,5 @@
using Remotely.Shared.Dtos;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using Remotely.Shared.Entities;
namespace Remotely.Shared.Models;

View File

@ -22,11 +22,11 @@
</ItemGroup>
<ItemGroup>
<Compile Update="Models\ScriptResult.cs">
<Compile Update="Entities\ScriptResult.cs">
<LastGenOutput>ScriptResult.cs.d.ts</LastGenOutput>
<Generator>DtsGenerator</Generator>
</Compile>
<Compile Update="Models\Device.cs">
<Compile Update="Entities\Device.cs">
<Generator></Generator>
</Compile>
<Compile Update="Models\RemotelyUserOptions.cs">

View File

@ -3,6 +3,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Remotely.Server.Services;
using Remotely.Shared.Dtos;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;

View File

@ -10,7 +10,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Remotely.Server.API;
using Remotely.Server.Data;
using Remotely.Server.Services;
using Remotely.Shared.Models;
using Remotely.Shared.Entities;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Generic;

View File

@ -5,6 +5,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Remotely.Server.Hubs;
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Enums;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;

View File

@ -6,6 +6,7 @@ using Remotely.Server.Areas.Identity.Pages.Account.Manage;
using Remotely.Server.Data;
using Remotely.Server.Services;
using Remotely.Shared.Dtos;
using Remotely.Shared.Entities;
using Remotely.Shared.Models;
using System;
using System.Linq;