mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-12 19:02:01 +01:00
* App: Add events which the app subscribes to Various events, which are relevant for the app to react to changes made on the server. * Refactor events * Do not extend NewBlockEvent * Refactoring events * Add store role events * Refactoring: Rename StoreUserEvent * Fix: Subscribe to UserEvent.Invited --------- Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BTCPayServer.Data;
|
|
|
|
namespace BTCPayServer.Events;
|
|
|
|
public class StoreEvent(StoreData store, string? detail = null)
|
|
{
|
|
public class Created(StoreData store, string? detail = null) : StoreEvent(store, detail)
|
|
{
|
|
protected override string ToString()
|
|
{
|
|
return $"{base.ToString()} has been created";
|
|
}
|
|
}
|
|
public class Removed(StoreData store, string? detail = null) : StoreEvent(store, detail)
|
|
{
|
|
protected override string ToString()
|
|
{
|
|
return $"{base.ToString()} has been removed";
|
|
}
|
|
}
|
|
public class Updated(StoreData store, string? detail = null) : StoreEvent(store, detail)
|
|
{
|
|
protected override string ToString()
|
|
{
|
|
return $"{base.ToString()} has been updated";
|
|
}
|
|
}
|
|
public string StoreId { get; } = store.Id;
|
|
public string? Detail { get; } = detail;
|
|
|
|
public IEnumerable<StoreUser>? StoreUsers { get; } = store.UserStores?.Select(userStore => new StoreUser
|
|
{
|
|
UserId = userStore.ApplicationUserId,
|
|
RoleId = userStore.StoreRoleId
|
|
});
|
|
|
|
protected new virtual string ToString()
|
|
{
|
|
return $"StoreEvent: Store \"{store.StoreName}\" ({store.Id})";
|
|
}
|
|
|
|
public class StoreUser
|
|
{
|
|
public string UserId { get; init; } = null!;
|
|
public string RoleId { get; set; } = null!;
|
|
}
|
|
}
|