2026-01-09 22:14:46 +01:00
|
|
|
// PlanTempus.X.Services.cs
|
2025-02-28 17:56:14 +01:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace PlanTempus.X.Services
|
|
|
|
|
{
|
|
|
|
|
// Models
|
2026-01-09 22:14:46 +01:00
|
|
|
public class Account
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
public string Email { get; set; }
|
|
|
|
|
public bool EmailConfirmed { get; set; }
|
|
|
|
|
public string Password { get; set; }
|
|
|
|
|
public bool IsLocked { get; set; }
|
|
|
|
|
public DateTime? LockoutEnd { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Organization
|
|
|
|
|
{
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string CreatedBy { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public class AccountOrganization
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
public string AccountId { get; set; }
|
2025-02-28 17:56:14 +01:00
|
|
|
public string OrganizationId { get; set; }
|
|
|
|
|
public string Role { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Service interfaces
|
2026-01-09 22:14:46 +01:00
|
|
|
public interface IAccountService
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
Task<Account> CreateAccountAsync(string email, string password);
|
|
|
|
|
Task<Account> GetAccountByEmailAsync(string email);
|
|
|
|
|
Account GetAccountByEmail(string email);
|
2025-02-28 17:56:14 +01:00
|
|
|
Task ConfirmEmailAsync(string confirmationToken);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IEmailService
|
|
|
|
|
{
|
|
|
|
|
Task<string> GetConfirmationLinkForEmail(string email);
|
|
|
|
|
bool WasConfirmationEmailSent(string email);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IOrganizationService
|
|
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
Task<Organization> SetupOrganizationAsync(string accountId, string orgName, string password);
|
|
|
|
|
Task<Organization> CreateOrganizationAsync(string accountId, string orgName);
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public interface IAccountOrganizationService
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
AccountOrganization GetAccountOrganization(string accountId, string organizationId);
|
|
|
|
|
List<AccountOrganization> GetAccountOrganizations(string accountId);
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface ITenantService
|
|
|
|
|
{
|
|
|
|
|
bool ValidateTenantTablesExist(string organizationId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IAuthService
|
|
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
bool IsAccountAuthenticated(string accountId);
|
2025-02-28 17:56:14 +01:00
|
|
|
Task<bool> AttemptLoginAsync(string email, string password);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Service implementations
|
2026-01-09 22:14:46 +01:00
|
|
|
public class AccountService : IAccountService
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
public async Task<Account> CreateAccountAsync(string email, string password)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
throw new NotImplementedException("CreateAccountAsync not implemented");
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public async Task<Account> GetAccountByEmailAsync(string email)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
throw new NotImplementedException("GetAccountByEmailAsync not implemented");
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public Account GetAccountByEmail(string email)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
throw new NotImplementedException("GetAccountByEmail not implemented");
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task ConfirmEmailAsync(string confirmationToken)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("ConfirmEmailAsync not implemented");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class EmailService : IEmailService
|
|
|
|
|
{
|
|
|
|
|
public async Task<string> GetConfirmationLinkForEmail(string email)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("GetConfirmationLinkForEmail not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool WasConfirmationEmailSent(string email)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("WasConfirmationEmailSent not implemented");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class OrganizationService : IOrganizationService
|
|
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
public async Task<Organization> SetupOrganizationAsync(string accountId, string orgName, string password)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("SetupOrganizationAsync not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public async Task<Organization> CreateOrganizationAsync(string accountId, string orgName)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("CreateOrganizationAsync not implemented");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public class AccountOrganizationService : IAccountOrganizationService
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
public AccountOrganization GetAccountOrganization(string accountId, string organizationId)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
throw new NotImplementedException("GetAccountOrganization not implemented");
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:14:46 +01:00
|
|
|
public List<AccountOrganization> GetAccountOrganizations(string accountId)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
throw new NotImplementedException("GetAccountOrganizations not implemented");
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TenantService : ITenantService
|
|
|
|
|
{
|
|
|
|
|
public bool ValidateTenantTablesExist(string organizationId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("ValidateTenantTablesExist not implemented");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class AuthService : IAuthService
|
|
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
public bool IsAccountAuthenticated(string accountId)
|
2025-02-28 17:56:14 +01:00
|
|
|
{
|
2026-01-09 22:14:46 +01:00
|
|
|
throw new NotImplementedException("IsAccountAuthenticated not implemented");
|
2025-02-28 17:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<bool> AttemptLoginAsync(string email, string password)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException("AttemptLoginAsync not implemented");
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-09 22:14:46 +01:00
|
|
|
}
|