btcpayserver/BTCPayServer/Events/AppEvent.cs
d11n 00cc16455c
App: Add events which the app subscribes to (#6435)
* 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>
2024-12-11 20:11:51 +09:00

37 lines
1.1 KiB
C#

#nullable enable
using BTCPayServer.Data;
namespace BTCPayServer.Events;
public class AppEvent(AppData app, string? detail = null)
{
public class Created(AppData app, string? detail = null) : AppEvent(app, detail ?? app.AppType)
{
protected override string ToString()
{
return $"{base.ToString()} has been created";
}
}
public class Deleted(AppData app, string? detail = null) : AppEvent(app, detail ?? app.AppType)
{
protected override string ToString()
{
return $"{base.ToString()} has been deleted";
}
}
public class Updated(AppData app, string? detail = null) : AppEvent(app, detail ?? app.AppType)
{
protected override string ToString()
{
return $"{base.ToString()} has been updated";
}
}
public string AppId { get; } = app.Id;
public string StoreId { get; } = app.StoreDataId;
public string? Detail { get; } = detail;
protected new virtual string ToString()
{
return $"AppEvent: App \"{app.Name}\" ({StoreId})";
}
}