diff --git a/src/Argon.Api/Entities/ApplicationDbContext.cs b/src/Argon.Api/Entities/ApplicationDbContext.cs index c5217cc7..b739e9eb 100644 --- a/src/Argon.Api/Entities/ApplicationDbContext.cs +++ b/src/Argon.Api/Entities/ApplicationDbContext.cs @@ -1,11 +1,8 @@ -namespace Argon.Api.Entities; +namespace Argon.Entities; using System.Drawing; using System.Linq.Expressions; -using Contracts.Models; -using Contracts.Models.ArchetypeModel; using Features.EF; -using Microsoft.EntityFrameworkCore; public class ApplicationDbContext(DbContextOptions options) : DbContext(options) { diff --git a/src/Argon.Api/Entities/UserAgreements.cs b/src/Argon.Api/Entities/UserAgreements.cs index 0ac7e4a9..3532ff53 100644 --- a/src/Argon.Api/Entities/UserAgreements.cs +++ b/src/Argon.Api/Entities/UserAgreements.cs @@ -1,7 +1,6 @@ -namespace Argon.Api.Entities; +namespace Argon.Entities; using System.ComponentModel.DataAnnotations; -using Contracts.Models; [MessagePackObject(true)] public record UserAgreements diff --git a/src/Argon.Api/Features/Captcha/CaptchaFeature.cs b/src/Argon.Api/Features/Captcha/CaptchaFeature.cs index e554707a..76a8c426 100644 --- a/src/Argon.Api/Features/Captcha/CaptchaFeature.cs +++ b/src/Argon.Api/Features/Captcha/CaptchaFeature.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; using Microsoft.Extensions.Configuration; diff --git a/src/Argon.Api/Features/Captcha/CaptchaKind.cs b/src/Argon.Api/Features/Captcha/CaptchaKind.cs index 5fbd541f..700d965f 100644 --- a/src/Argon.Api/Features/Captcha/CaptchaKind.cs +++ b/src/Argon.Api/Features/Captcha/CaptchaKind.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; public enum CaptchaKind { diff --git a/src/Argon.Api/Features/Captcha/CaptchaOptions.cs b/src/Argon.Api/Features/Captcha/CaptchaOptions.cs index bad74a77..853ea2a9 100644 --- a/src/Argon.Api/Features/Captcha/CaptchaOptions.cs +++ b/src/Argon.Api/Features/Captcha/CaptchaOptions.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; public class CaptchaOptions { diff --git a/src/Argon.Api/Features/Captcha/CloudflareCaptcha.cs b/src/Argon.Api/Features/Captcha/CloudflareCaptcha.cs index 26fd8e7c..5221723d 100644 --- a/src/Argon.Api/Features/Captcha/CloudflareCaptcha.cs +++ b/src/Argon.Api/Features/Captcha/CloudflareCaptcha.cs @@ -1,9 +1,6 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; -using Argon.Features; -using Extensions; using Flurl.Http; -using Microsoft.Extensions.Options; public class CloudflareCaptcha(IHttpContextAccessor accessor, ILogger logger, IOptions options) : ICaptchaFeature { diff --git a/src/Argon.Api/Features/Captcha/ICaptchaFeature.cs b/src/Argon.Api/Features/Captcha/ICaptchaFeature.cs index 1387fb2f..7fc806ff 100644 --- a/src/Argon.Api/Features/Captcha/ICaptchaFeature.cs +++ b/src/Argon.Api/Features/Captcha/ICaptchaFeature.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; public interface ICaptchaFeature { diff --git a/src/Argon.Api/Features/Captcha/NullCaptcha.cs b/src/Argon.Api/Features/Captcha/NullCaptcha.cs index 8fbac6d2..21e6dd84 100644 --- a/src/Argon.Api/Features/Captcha/NullCaptcha.cs +++ b/src/Argon.Api/Features/Captcha/NullCaptcha.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; public class NullCaptcha : ICaptchaFeature { diff --git a/src/Argon.Api/Features/Captcha/YandexCaptcha.cs b/src/Argon.Api/Features/Captcha/YandexCaptcha.cs index 91aa6fcc..ae046139 100644 --- a/src/Argon.Api/Features/Captcha/YandexCaptcha.cs +++ b/src/Argon.Api/Features/Captcha/YandexCaptcha.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Captcha; +namespace Argon.Features.Captcha; public class YandexCaptcha : ICaptchaFeature { diff --git a/src/Argon.Api/Features/EF/ColourConverter.cs b/src/Argon.Api/Features/EF/ColourConverter.cs index 27f1b3ed..1199d6d5 100644 --- a/src/Argon.Api/Features/EF/ColourConverter.cs +++ b/src/Argon.Api/Features/EF/ColourConverter.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.EF; +namespace Argon.Features.EF; using System.Drawing; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/src/Argon.Api/Features/EF/TimeStampAndSoftDeleteInterceptor.cs b/src/Argon.Api/Features/EF/TimeStampAndSoftDeleteInterceptor.cs index 773ffa24..4d5116f6 100644 --- a/src/Argon.Api/Features/EF/TimeStampAndSoftDeleteInterceptor.cs +++ b/src/Argon.Api/Features/EF/TimeStampAndSoftDeleteInterceptor.cs @@ -1,8 +1,6 @@ -namespace Argon.Api.Features.EF; +namespace Argon.Features.EF; -using Contracts.Models; using Microsoft.EntityFrameworkCore.Diagnostics; -using Microsoft.EntityFrameworkCore; public class TimeStampAndSoftDeleteInterceptor : SaveChangesInterceptor { diff --git a/src/Argon.Api/Features/Env/EnvironmentExtensions.cs b/src/Argon.Api/Features/Env/EnvironmentExtensions.cs index 3c398c8d..4e3e130e 100644 --- a/src/Argon.Api/Features/Env/EnvironmentExtensions.cs +++ b/src/Argon.Api/Features/Env/EnvironmentExtensions.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Env; +namespace Argon.Features.Env; using static File; diff --git a/src/Argon.Api/Features/Jwt/JwtFeature.cs b/src/Argon.Api/Features/Jwt/JwtFeature.cs index c3dc9f56..ac221b87 100644 --- a/src/Argon.Api/Features/Jwt/JwtFeature.cs +++ b/src/Argon.Api/Features/Jwt/JwtFeature.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Jwt; +namespace Argon.Features.Jwt; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.IdentityModel.Tokens; diff --git a/src/Argon.Api/Features/Jwt/JwtOptions.cs b/src/Argon.Api/Features/Jwt/JwtOptions.cs index 59d644ba..7e8011eb 100644 --- a/src/Argon.Api/Features/Jwt/JwtOptions.cs +++ b/src/Argon.Api/Features/Jwt/JwtOptions.cs @@ -1,6 +1,6 @@ -namespace Argon.Api.Features.Jwt; +namespace Argon.Features.Jwt; -using Argon.Api.Services; +using Argon.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; public record JwtOptions diff --git a/src/Argon.Api/Features/Jwt/TokenAuthorization.cs b/src/Argon.Api/Features/Jwt/TokenAuthorization.cs index baa0edb0..e873ae69 100644 --- a/src/Argon.Api/Features/Jwt/TokenAuthorization.cs +++ b/src/Argon.Api/Features/Jwt/TokenAuthorization.cs @@ -1,7 +1,6 @@ -namespace Argon.Api.Features.Jwt; +namespace Argon.Features.Jwt; using System.IdentityModel.Tokens.Jwt; -using Contracts; using Microsoft.IdentityModel.Tokens; public class TokenAuthorization(TokenValidationParameters tokenValidation) diff --git a/src/Argon.Api/Features/Jwt/TokenUserData.cs b/src/Argon.Api/Features/Jwt/TokenUserData.cs index 2f4cf2fa..5a9274f1 100644 --- a/src/Argon.Api/Features/Jwt/TokenUserData.cs +++ b/src/Argon.Api/Features/Jwt/TokenUserData.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Jwt; +namespace Argon.Features.Jwt; [GenerateSerializer, Alias("Argon.Api.Features.Jwt.TokenUserData")] public record TokenUserData(Guid id, Guid machineId); \ No newline at end of file diff --git a/src/Argon.Api/Features/Orleanse/BalanceRule.cs b/src/Argon.Api/Features/Orleanse/BalanceRule.cs index c82ac6e3..9360404b 100644 --- a/src/Argon.Api/Features/Orleanse/BalanceRule.cs +++ b/src/Argon.Api/Features/Orleanse/BalanceRule.cs @@ -1,6 +1,5 @@ -namespace Argon.Api.Features; +namespace Argon.Features; -using System.Collections.Concurrent; using System.Globalization; using Env; using k8s; diff --git a/src/Argon.Api/Features/Orleanse/MemoryPackCodec.cs b/src/Argon.Api/Features/Orleanse/MemoryPackCodec.cs index cff95b0f..5705d2c6 100644 --- a/src/Argon.Api/Features/Orleanse/MemoryPackCodec.cs +++ b/src/Argon.Api/Features/Orleanse/MemoryPackCodec.cs @@ -1,13 +1,10 @@ using System; using System.Buffers; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Reflection; using System.Runtime.Serialization; using MemoryPack; using MessagePack; -using Microsoft.Extensions.Options; using Orleans.Serialization.Buffers; using Orleans.Serialization.Buffers.Adaptors; using Orleans.Serialization.Cloning; diff --git a/src/Argon.Api/Features/Orleanse/MemoryPackStorageSerializer.cs b/src/Argon.Api/Features/Orleanse/MemoryPackStorageSerializer.cs index 26f0086c..8b2fa25c 100644 --- a/src/Argon.Api/Features/Orleanse/MemoryPackStorageSerializer.cs +++ b/src/Argon.Api/Features/Orleanse/MemoryPackStorageSerializer.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features; +namespace Argon.Features; using System.Runtime.CompilerServices; using MemoryPack; diff --git a/src/Argon.Api/Features/Orleanse/RedisExtensions.cs b/src/Argon.Api/Features/Orleanse/RedisExtensions.cs index 49a0f1fc..3f5011f3 100644 --- a/src/Argon.Api/Features/Orleanse/RedisExtensions.cs +++ b/src/Argon.Api/Features/Orleanse/RedisExtensions.cs @@ -1,7 +1,6 @@ -namespace Argon.Api.Extensions; +namespace Argon.Extensions; using Features.Orleanse.Storages; -using Microsoft.Extensions.Options; using Orleans.Configuration; using Orleans.Runtime.Hosting; using Orleans.Storage; diff --git a/src/Argon.Api/Features/Orleanse/Storages/RedisStorage.cs b/src/Argon.Api/Features/Orleanse/Storages/RedisStorage.cs index 81e19eb5..7f9c5057 100644 --- a/src/Argon.Api/Features/Orleanse/Storages/RedisStorage.cs +++ b/src/Argon.Api/Features/Orleanse/Storages/RedisStorage.cs @@ -1,6 +1,5 @@ -namespace Argon.Api.Features.Orleanse.Storages; +namespace Argon.Features.Orleanse.Storages; -using Microsoft.Extensions.Options; using Orleans.Configuration; using Orleans.Configuration.Overrides; using Orleans.Providers; diff --git a/src/Argon.Api/Features/Orleanse/Streams/ClientArgonStream.cs b/src/Argon.Api/Features/Orleanse/Streams/ClientArgonStream.cs index 566a18d7..a46a708a 100644 --- a/src/Argon.Api/Features/Orleanse/Streams/ClientArgonStream.cs +++ b/src/Argon.Api/Features/Orleanse/Streams/ClientArgonStream.cs @@ -1,8 +1,7 @@ -namespace Argon.Api.Features.Rpc; +namespace Argon.Features.Rpc; using Orleans.Streams; using System.Threading.Channels; -using Contracts; public sealed class ClientArgonStream : IArgonStream where T : IArgonEvent { diff --git a/src/Argon.Api/Features/Orleanse/Streams/IArgonStream.cs b/src/Argon.Api/Features/Orleanse/Streams/IArgonStream.cs index 46bc8115..9b9c7fdf 100644 --- a/src/Argon.Api/Features/Orleanse/Streams/IArgonStream.cs +++ b/src/Argon.Api/Features/Orleanse/Streams/IArgonStream.cs @@ -1,12 +1,3 @@ -namespace Argon.Api.Features.Rpc; +namespace Argon.Features.Rpc; -using ActualLab.Rpc; -using Contracts; using Orleans.Streams; - -public interface IArgonStream : - IAsyncObserver, IAsyncEnumerable, IAsyncDisposable where T : IArgonEvent -{ - public RpcStream AsRpcStream() => new(this); - ValueTask Fire(T ev); -} \ No newline at end of file diff --git a/src/Argon.Api/Features/Orleanse/Streams/IStreamExtension.cs b/src/Argon.Api/Features/Orleanse/Streams/IStreamExtension.cs index 8d571afb..e1ffa98f 100644 --- a/src/Argon.Api/Features/Orleanse/Streams/IStreamExtension.cs +++ b/src/Argon.Api/Features/Orleanse/Streams/IStreamExtension.cs @@ -1,6 +1,4 @@ -namespace Argon.Api.Features.Rpc; - -using Contracts; +namespace Argon.Features.Rpc; public interface IStreamExtension { diff --git a/src/Argon.Api/Features/Orleanse/Streams/NatsAdapterFactory.cs b/src/Argon.Api/Features/Orleanse/Streams/NatsAdapterFactory.cs index cfef8d61..fbad24a1 100644 --- a/src/Argon.Api/Features/Orleanse/Streams/NatsAdapterFactory.cs +++ b/src/Argon.Api/Features/Orleanse/Streams/NatsAdapterFactory.cs @@ -1,7 +1,5 @@ -namespace Argon.Api.Features.OrleansStreamingProviders; +namespace Argon.Features.OrleansStreamingProviders; -using System.Collections.Concurrent; -using Argon.Features; using NATS.Client.Core; using NATS.Client.JetStream; using Orleans.Configuration; diff --git a/src/Argon.Api/Features/Orleanse/Streams/NatsSvackaMamuWentToKino.cs b/src/Argon.Api/Features/Orleanse/Streams/NatsSvackaMamuWentToKino.cs index 0c807ec4..e5e1e00c 100644 --- a/src/Argon.Api/Features/Orleanse/Streams/NatsSvackaMamuWentToKino.cs +++ b/src/Argon.Api/Features/Orleanse/Streams/NatsSvackaMamuWentToKino.cs @@ -1,6 +1,5 @@ -namespace Argon.Api.Features.OrleansStreamingProviders; +namespace Argon.Features.OrleansStreamingProviders; -using Argon.Features; using NATS.Client.JetStream; using NATS.Client.JetStream.Models; using NATS.Net; diff --git a/src/Argon.Api/Features/Orleanse/Streams/ServerArgonStream.cs b/src/Argon.Api/Features/Orleanse/Streams/ServerArgonStream.cs index c4ca8a85..701712d7 100644 --- a/src/Argon.Api/Features/Orleanse/Streams/ServerArgonStream.cs +++ b/src/Argon.Api/Features/Orleanse/Streams/ServerArgonStream.cs @@ -1,6 +1,5 @@ -namespace Argon.Api.Features.Rpc; +namespace Argon.Features.Rpc; -using Contracts; using Orleans.Streams; public sealed class ServerArgonStream(IAsyncStream stream) : IArgonStream where T : IArgonEvent diff --git a/src/Argon.Api/Features/Otp/OtpGenerator.cs b/src/Argon.Api/Features/Otp/OtpGenerator.cs index f42870c0..cc53ed78 100644 --- a/src/Argon.Api/Features/Otp/OtpGenerator.cs +++ b/src/Argon.Api/Features/Otp/OtpGenerator.cs @@ -1,7 +1,6 @@ -namespace Argon.Api.Features.Otp; +namespace Argon.Features.Otp; using Microsoft.AspNetCore.DataProtection; -using Microsoft.Extensions.Options; using OtpNet; using Services; diff --git a/src/Argon.Api/Features/Pex/IPermissionProvider.cs b/src/Argon.Api/Features/Pex/IPermissionProvider.cs index 8074bdc3..f9559282 100644 --- a/src/Argon.Api/Features/Pex/IPermissionProvider.cs +++ b/src/Argon.Api/Features/Pex/IPermissionProvider.cs @@ -1,9 +1,4 @@ -namespace Argon.Api.Features.Pex; - -using ActualLab.Collections; -using Contracts.Models.ArchetypeModel; -using Entities; -using Microsoft.EntityFrameworkCore; +namespace Argon.Features.Pex; public static class PexFeature { diff --git a/src/Argon.Api/Features/Repositories/IServerRepository.cs b/src/Argon.Api/Features/Repositories/IServerRepository.cs index c3fc8c71..6f010699 100644 --- a/src/Argon.Api/Features/Repositories/IServerRepository.cs +++ b/src/Argon.Api/Features/Repositories/IServerRepository.cs @@ -1,11 +1,6 @@ -namespace Argon.Api.Features.Repositories; +namespace Argon.Features.Repositories; using System.Diagnostics; -using Contracts.Models; -using Contracts.Models.ArchetypeModel; -using Entities; -using Grains.Interfaces; -using Microsoft.EntityFrameworkCore; public static class TemplateFeature { diff --git a/src/Argon.Api/Features/Sentry/SentryOrleansFilter.cs b/src/Argon.Api/Features/Sentry/SentryOrleansFilter.cs index 1173fb1a..27bb1914 100644 --- a/src/Argon.Api/Features/Sentry/SentryOrleansFilter.cs +++ b/src/Argon.Api/Features/Sentry/SentryOrleansFilter.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Features.Sentry; +namespace Argon.Features.Sentry; public class SentryGrainCallFilter : IIncomingGrainCallFilter { diff --git a/src/Argon.Api/Features/Sfu/ArgonSelectiveForwardingUnit.cs b/src/Argon.Api/Features/Sfu/ArgonSelectiveForwardingUnit.cs index 9d238b58..29dc08ad 100644 --- a/src/Argon.Api/Features/Sfu/ArgonSelectiveForwardingUnit.cs +++ b/src/Argon.Api/Features/Sfu/ArgonSelectiveForwardingUnit.cs @@ -4,7 +4,6 @@ namespace Argon.Sfu; using Flurl.Http; using LiveKit.Proto; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; #if DEBUG diff --git a/src/Argon.Api/Features/Sfu/SfuFeature.cs b/src/Argon.Api/Features/Sfu/SfuFeature.cs index 702cc836..8ecf1440 100644 --- a/src/Argon.Api/Features/Sfu/SfuFeature.cs +++ b/src/Argon.Api/Features/Sfu/SfuFeature.cs @@ -2,7 +2,6 @@ using Flurl.Http; using Flurl.Http.Newtonsoft; -using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; diff --git a/src/Argon.Api/Features/Template/TemplateFeature.cs b/src/Argon.Api/Features/Template/TemplateFeature.cs index 721db155..e71d35df 100644 --- a/src/Argon.Api/Features/Template/TemplateFeature.cs +++ b/src/Argon.Api/Features/Template/TemplateFeature.cs @@ -1,6 +1,5 @@ -namespace Argon.Api.Features.Template; +namespace Argon.Features.Template; -using System.Collections.Concurrent; using Fluid; public static class TemplateFeature diff --git a/src/Argon.Api/Features/Utils/ActorExtensions.cs b/src/Argon.Api/Features/Utils/ActorExtensions.cs index d11ee50e..7b6c1f5d 100644 --- a/src/Argon.Api/Features/Utils/ActorExtensions.cs +++ b/src/Argon.Api/Features/Utils/ActorExtensions.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Extensions; +namespace Argon.Extensions; public static class ActorExtensions { diff --git a/src/Argon.Api/Features/Utils/ObjDiff.cs b/src/Argon.Api/Features/Utils/ObjDiff.cs index 6512de3e..267a5f21 100644 --- a/src/Argon.Api/Features/Utils/ObjDiff.cs +++ b/src/Argon.Api/Features/Utils/ObjDiff.cs @@ -1,10 +1,6 @@ namespace Argon.Features; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Reflection; -using ActualLab.Collections; -using ActualLab.Text; public static class ObjDiff { @@ -46,7 +42,7 @@ public static PropertyBag Compare(T prev, T next) var updatedValue = prop.GetValue(next)!; if (!IsAreEqual(prop.PropertyType, prevValue, updatedValue)) - props.Set(new Symbol(prop.Name), updatedValue); + props.Set(prop.Name, updatedValue); } return props; diff --git a/src/Argon.Api/Features/Utils/SwaggerExtension.cs b/src/Argon.Api/Features/Utils/SwaggerExtension.cs index a0dda70b..f08afbfd 100644 --- a/src/Argon.Api/Features/Utils/SwaggerExtension.cs +++ b/src/Argon.Api/Features/Utils/SwaggerExtension.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Extensions; +namespace Argon.Extensions; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; diff --git a/src/Argon.Api/Grains/AuthorizationGrain.cs b/src/Argon.Api/Grains/AuthorizationGrain.cs index 9b7dc184..80ba11a4 100644 --- a/src/Argon.Api/Grains/AuthorizationGrain.cs +++ b/src/Argon.Api/Grains/AuthorizationGrain.cs @@ -1,11 +1,6 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using Contracts; -using Contracts.Models; -using Entities; using Features.Otp; -using Interfaces; -using Microsoft.EntityFrameworkCore; using Services; public class AuthorizationGrain( @@ -15,7 +10,7 @@ public class AuthorizationGrain( IPasswordHashingService passwordHashingService, ApplicationDbContext context) : Grain, IAuthorizationGrain { - public async Task> Authorize(UserCredentialsInput input, UserConnectionInfo connectionInfo) + public async Task> Authorize(UserCredentialsInput input, UserConnectionInfo connectionInfo) { var user = await context.Users.FirstOrDefaultAsync(u => u.Email == input.Email); if (user is null) @@ -125,5 +120,5 @@ await strategy.ExecuteAsync(async () => return Maybe.None(); } - private async Task GenerateJwt(User User, Guid machineId) => new(await managerService.GenerateJwt(User.Id, machineId)); + private async Task GenerateJwt(User User, Guid machineId) => await managerService.GenerateJwt(User.Id, machineId); } \ No newline at end of file diff --git a/src/Argon.Api/Grains/ChannelGrain.cs b/src/Argon.Api/Grains/ChannelGrain.cs index f64c6bc5..1d295a8f 100644 --- a/src/Argon.Api/Grains/ChannelGrain.cs +++ b/src/Argon.Api/Grains/ChannelGrain.cs @@ -1,24 +1,20 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using Contracts; -using Contracts.Models; -using Entities; using Features.Rpc; -using Interfaces; -using Microsoft.EntityFrameworkCore; using Persistence.States; using Sfu; +using Argon.Servers; public class ChannelGrain( IArgonSelectiveForwardingUnit sfu, ApplicationDbContext context, - [PersistentState("channelGrainState", "OrleansStorage")] + [PersistentState("channelGrainState", "OrleansStorage")] IPersistentState state) : Grain, IChannelGrain { private IArgonStream _userStateEmitter = null!; - private Channel _self { get; set; } + private Channel _self { get; set; } private ArgonServerId ServerId => new(_self.ServerId); private ArgonChannelId ChannelId => new(ServerId, this.GetPrimaryKey()); @@ -36,8 +32,16 @@ public async Task> Join(Guid userId) if (_self.ChannelType != ChannelType.Voice) return Maybe.None(); - state.State.Users.Add(userId, new ChannelRealtimeMember(userId)); - await state.WriteStateAsync(); + if (state.State.Users.ContainsKey(userId)) + { + //await _userStateEmitter.Fire( + // new OnChannelUserChangedState(userId, ON_LEAVED)); + } + else + { + state.State.Users.Add(userId, new ChannelRealtimeMember(userId)); + await state.WriteStateAsync(); + } //await _userStateEmitter.Fire( // new OnChannelUserChangedState(userId, ON_JOINED)); diff --git a/src/Argon.Api/Grains/EmailManager.cs b/src/Argon.Api/Grains/EmailManager.cs index 4c2f20f7..354aa880 100644 --- a/src/Argon.Api/Grains/EmailManager.cs +++ b/src/Argon.Api/Grains/EmailManager.cs @@ -1,10 +1,8 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; using System.Net; using System.Net.Mail; using Features.Template; -using Interfaces; -using Microsoft.Extensions.Options; public class EmailManager(IOptions smtpOptions, ILogger logger, EMailFormStorage formStorage) : Grain, IEmailManager { diff --git a/src/Argon.Api/Grains/FusionGrain.cs b/src/Argon.Api/Grains/FusionGrain.cs index b1014b35..c98f5861 100644 --- a/src/Argon.Api/Grains/FusionGrain.cs +++ b/src/Argon.Api/Grains/FusionGrain.cs @@ -1,10 +1,7 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using Contracts; -using Extensions; using Features.Jwt; using Features.Rpc; -using Interfaces; using R3; using static DeactivationReasonCode; diff --git a/src/Argon.Api/Grains/Interfaces/IAuthorizationGrain.cs b/src/Argon.Api/Grains/Interfaces/IAuthorizationGrain.cs index b4297a97..66cbbfc7 100644 --- a/src/Argon.Api/Grains/Interfaces/IAuthorizationGrain.cs +++ b/src/Argon.Api/Grains/Interfaces/IAuthorizationGrain.cs @@ -1,6 +1,6 @@ namespace Argon.Grains.Interfaces; -[Alias("Argon.Api.Grains.Interfaces.IAuthorizationGrain")] +[Alias("Argon.Grains.Interfaces.IAuthorizationGrain")] public interface IAuthorizationGrain : IGrainWithGuidKey { [Alias("Authorize")] @@ -10,7 +10,7 @@ public interface IAuthorizationGrain : IGrainWithGuidKey Task> Register(NewUserCredentialsInput input, UserConnectionInfo connectionInfo); } -[Alias("Argon.Api.Grains.Interfaces.IUserMachineSessions")] +[Alias("Argon.Grains.Interfaces.IUserMachineSessions")] public interface IUserMachineSessions : IGrainWithGuidKey { [Alias("CreateMachineKey")] diff --git a/src/Argon.Api/Grains/Interfaces/IChannelGrain.cs b/src/Argon.Api/Grains/Interfaces/IChannelGrain.cs index 26e5c6ba..81a8bdce 100644 --- a/src/Argon.Api/Grains/Interfaces/IChannelGrain.cs +++ b/src/Argon.Api/Grains/Interfaces/IChannelGrain.cs @@ -1,10 +1,9 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; -using Contracts; -using Contracts.Models; -using Entities; using Sfu; +using Argon.Servers; +[Alias("Argon.Grains.Interfaces.IChannelGrain")] public interface IChannelGrain : IGrainWithGuidKey { [Alias("Join")] diff --git a/src/Argon.Api/Grains/Interfaces/IEmailManager.cs b/src/Argon.Api/Grains/Interfaces/IEmailManager.cs index 559ec4b5..c05cccfa 100644 --- a/src/Argon.Api/Grains/Interfaces/IEmailManager.cs +++ b/src/Argon.Api/Grains/Interfaces/IEmailManager.cs @@ -1,4 +1,4 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; public record SmtpConfig { @@ -9,6 +9,7 @@ public record SmtpConfig public bool UseSsl { get; set; } } +[Alias("Argon.Grains.Interfaces.IEmailManager")] public interface IEmailManager : IGrainWithGuidKey { Task SendOtpCodeAsync(string email, string otpCode, TimeSpan validity); diff --git a/src/Argon.Api/Grains/Interfaces/IFusionSessionGrain.cs b/src/Argon.Api/Grains/Interfaces/IFusionSessionGrain.cs index a17a1383..04cc978c 100644 --- a/src/Argon.Api/Grains/Interfaces/IFusionSessionGrain.cs +++ b/src/Argon.Api/Grains/Interfaces/IFusionSessionGrain.cs @@ -1,9 +1,8 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; -using Argon.Contracts; using Features.Jwt; -[Alias("Argon.Api.Grains.Interfaces.IFusionSessionGrain")] +[Alias("Argon.Grains.Interfaces.IFusionSessionGrain")] public interface IFusionSessionGrain : IGrainWithGuidKey { [Alias("BeginRealtimeSession")] diff --git a/src/Argon.Api/Grains/Interfaces/IServerGrain.cs b/src/Argon.Api/Grains/Interfaces/IServerGrain.cs index 9aa0a5d6..636cb675 100644 --- a/src/Argon.Api/Grains/Interfaces/IServerGrain.cs +++ b/src/Argon.Api/Grains/Interfaces/IServerGrain.cs @@ -1,9 +1,6 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; -using Contracts; -using Contracts.Models; - -[Alias("Argon.Api.Grains.Interfaces.IServerGrain")] +[Alias("Argon.Grains.Interfaces.IServerGrain")] public interface IServerGrain : IGrainWithGuidKey { [Alias("CreateServer")] diff --git a/src/Argon.Api/Grains/Interfaces/ISessionManager.cs b/src/Argon.Api/Grains/Interfaces/ISessionManager.cs index c4ab7ede..6c6df358 100644 --- a/src/Argon.Api/Grains/Interfaces/ISessionManager.cs +++ b/src/Argon.Api/Grains/Interfaces/ISessionManager.cs @@ -1,8 +1,6 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; -using Contracts.Models; - -[Alias("Argon.Api.Grains.Interfaces.ISessionManager")] +[Alias("Argon.Grains.Interfaces.ISessionManager")] public interface ISessionManager : IGrainWithGuidKey { [Alias("GetUser")] diff --git a/src/Argon.Api/Grains/Interfaces/ITestGrain.cs b/src/Argon.Api/Grains/Interfaces/ITestGrain.cs deleted file mode 100644 index 99393662..00000000 --- a/src/Argon.Api/Grains/Interfaces/ITestGrain.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Argon.Api.Grains.Interfaces; - -#if DEBUG -[DataContract, MemoryPackable(GenerateType.VersionTolerant), MessagePackObject, Serializable, GenerateSerializer, Alias(nameof(SomeInput))] -public sealed partial record SomeInput( - [property: DataMember(Order = 0), MemoryPackOrder(0), Key(0), Id(0)] - long a, - [property: DataMember(Order = 1), MemoryPackOrder(1), Key(1), Id(1)] - string b); - -[Alias("Argon.Api.Grains.Interfaces.ITestGrain")] -public interface ITestGrain : IGrainWithGuidKey -{ - [Alias("CreateSomeInput")] - Task CreateSomeInput(SomeInput input); - - [Alias("UpdateSomeInput")] - Task UpdateSomeInput(SomeInput input); - - [Alias("DeleteSomeInput")] - Task DeleteSomeInput(); - - [Alias("GetSomeInput")] - Task GetSomeInput(); -} - -[Alias("Argon.Api.Grains.Interfaces.IStreamProducerGrain")] -public interface IStreamProducerGrain : IGrainWithGuidKey -{ - [Alias("Produce")] - Task Produce(); -} - -[Alias("Argon.Api.Grains.Interfaces.IStreamConsumerGrain")] -public interface IStreamConsumerGrain : IGrainWithGuidKey -{ - [Alias("Consume")] - Task Consume(); -} -#endif \ No newline at end of file diff --git a/src/Argon.Api/Grains/Interfaces/IUserGrain.cs b/src/Argon.Api/Grains/Interfaces/IUserGrain.cs index 2535c1b6..e08ffb13 100644 --- a/src/Argon.Api/Grains/Interfaces/IUserGrain.cs +++ b/src/Argon.Api/Grains/Interfaces/IUserGrain.cs @@ -1,9 +1,6 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; -using Contracts; -using Contracts.Models; - -[Alias("Argon.Api.Grains.Interfaces.IUserGrain")] +[Alias("Argon.Grains.Interfaces.IUserGrain")] public interface IUserGrain : IGrainWithGuidKey { [Alias(nameof(UpdateUser))] diff --git a/src/Argon.Api/Grains/Interfaces/IUserPreferenceGrain.cs b/src/Argon.Api/Grains/Interfaces/IUserPreferenceGrain.cs index 50c0bbbb..ab60e172 100644 --- a/src/Argon.Api/Grains/Interfaces/IUserPreferenceGrain.cs +++ b/src/Argon.Api/Grains/Interfaces/IUserPreferenceGrain.cs @@ -1,6 +1,4 @@ -namespace Argon.Api.Grains.Interfaces; +namespace Argon.Grains.Interfaces; -using Contracts; - -[Alias("Argon.Api.Grains.Interfaces.IUserPreferenceGrain")] +[Alias("Argon.Grains.Interfaces.IUserPreferenceGrain")] public interface IUserPreferenceGrain : IGrainWithGuidKey, IUserPreferenceInteraction; \ No newline at end of file diff --git a/src/Argon.Api/Grains/ServerGrain.cs b/src/Argon.Api/Grains/ServerGrain.cs index f12bfb2d..e5558a32 100644 --- a/src/Argon.Api/Grains/ServerGrain.cs +++ b/src/Argon.Api/Grains/ServerGrain.cs @@ -1,15 +1,8 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using ActualLab.Collections; -using Contracts; -using Entities; -using Interfaces; -using Microsoft.EntityFrameworkCore; -using Argon.Api.Features.Rpc; -using Contracts.Models; +using Argon.Features.Rpc; +using Features.Repositories; using Persistence.States; -using Argon.Api.Features.Repositories; -using Argon.Features; public class ServerGrain( IGrainFactory grainFactory, diff --git a/src/Argon.Api/Grains/SessionManager.cs b/src/Argon.Api/Grains/SessionManager.cs index 57c200a1..d879ae14 100644 --- a/src/Argon.Api/Grains/SessionManager.cs +++ b/src/Argon.Api/Grains/SessionManager.cs @@ -1,8 +1,5 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using Contracts.Models; -using Entities; -using Interfaces; using Microsoft.Extensions.Logging; using Orleans; using Services; diff --git a/src/Argon.Api/Grains/States/ChannelGrainState.cs b/src/Argon.Api/Grains/States/ChannelGrainState.cs index 8aa550c2..436da1c4 100644 --- a/src/Argon.Api/Grains/States/ChannelGrainState.cs +++ b/src/Argon.Api/Grains/States/ChannelGrainState.cs @@ -1,7 +1,4 @@ -namespace Argon.Api.Grains.Persistence.States; - -using Contracts; -using Entities; +namespace Argon.Grains.Persistence.States; [DataContract, MemoryPackable(GenerateType.VersionTolerant), MessagePackObject(true), Serializable, GenerateSerializer] public sealed partial record ChannelGrainState diff --git a/src/Argon.Api/Grains/States/UserPreferencesGrainState.cs b/src/Argon.Api/Grains/States/UserPreferencesGrainState.cs index 9be622cd..7927c81e 100644 --- a/src/Argon.Api/Grains/States/UserPreferencesGrainState.cs +++ b/src/Argon.Api/Grains/States/UserPreferencesGrainState.cs @@ -1,6 +1,4 @@ -namespace Argon.Api.Grains.Persistence.States; - -using ActualLab.Text; +namespace Argon.Grains.Persistence.States; [DataContract, MemoryPackable(GenerateType.VersionTolerant), MessagePackObject(true), Serializable, GenerateSerializer] public sealed partial record UserPreferencesGrainState diff --git a/src/Argon.Api/Grains/TestGrain.cs b/src/Argon.Api/Grains/TestGrain.cs index feba8540..0117a90f 100644 --- a/src/Argon.Api/Grains/TestGrain.cs +++ b/src/Argon.Api/Grains/TestGrain.cs @@ -1,7 +1,5 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using Contracts; -using Interfaces; using Orleans.Providers.Streams.Common; using Orleans.Streams; diff --git a/src/Argon.Api/Grains/UserPreferenceGrain.cs b/src/Argon.Api/Grains/UserPreferenceGrain.cs index 038cd97b..7129bb87 100644 --- a/src/Argon.Api/Grains/UserPreferenceGrain.cs +++ b/src/Argon.Api/Grains/UserPreferenceGrain.cs @@ -1,7 +1,5 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using ActualLab.Text; -using Interfaces; using Persistence.States; public class UserPreferenceGrain([PersistentState("userPreferences", "OrleansStorage")] @@ -17,7 +15,7 @@ public override Task OnDeactivateAsync(DeactivationReason reason, CancellationTo public Task SavePreferences(Symbol scope, string value) { - if(value.Length * 2 > MaxSymbolSize) + if (value.Length * 2 > MaxSymbolSize) return Task.CompletedTask; // ignore if (state.State.UserPreferences.Count > 10) return Task.CompletedTask; diff --git a/src/Argon.Api/Grains/UserSessionGrain.cs b/src/Argon.Api/Grains/UserSessionGrain.cs index 7124624d..89312c28 100644 --- a/src/Argon.Api/Grains/UserSessionGrain.cs +++ b/src/Argon.Api/Grains/UserSessionGrain.cs @@ -1,7 +1,5 @@ -namespace Argon.Api.Grains; +namespace Argon.Grains; -using Contracts; -using Interfaces; using Microsoft.Extensions.Logging; public class UserMachineSessions( diff --git a/src/Argon.Api/Services/IPasswordHashingService.cs b/src/Argon.Api/Services/IPasswordHashingService.cs index 70b5bee9..54dabf8e 100644 --- a/src/Argon.Api/Services/IPasswordHashingService.cs +++ b/src/Argon.Api/Services/IPasswordHashingService.cs @@ -1,6 +1,5 @@ -namespace Argon.Api.Services; +namespace Argon.Services; -using Contracts.Models; using Features.Otp; public interface IPasswordHashingService diff --git a/src/Argon.Api/Services/UserManagerService.cs b/src/Argon.Api/Services/UserManagerService.cs index e5658083..43352966 100644 --- a/src/Argon.Api/Services/UserManagerService.cs +++ b/src/Argon.Api/Services/UserManagerService.cs @@ -1,9 +1,8 @@ -namespace Argon.Api.Services; +namespace Argon.Services; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using Features.Jwt; -using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; public class UserManagerService(ILogger logger, IOptions jwt, IConfiguration configuration)