Add controlled FAQ auto-replies with test mode and durable sending limits
This commit is contained in:
@@ -34,6 +34,7 @@ builder.Services.AddHttpClient<OhipClient>(c => c.Timeout = TimeSpan.FromSeconds
|
||||
builder.Services.AddTransient<PmsWork>();
|
||||
builder.Services.AddHttpClient<NmiInvoices>(c=>c.Timeout=TimeSpan.FromSeconds(25)).ConfigurePrimaryHttpMessageHandler(()=>new HttpClientHandler{AllowAutoRedirect=false});
|
||||
builder.Services.AddTransient<PaymentWork>();
|
||||
builder.Services.AddTransient<AutoReplyWork>();
|
||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(o =>
|
||||
{
|
||||
o.Cookie.Name = "guestops.session"; o.Cookie.HttpOnly = true; o.Cookie.SameSite = SameSiteMode.Lax;
|
||||
@@ -130,6 +131,7 @@ if (preview) app.MapPost("/api/preview/start", async (HttpContext c, Cancellatio
|
||||
var api = app.MapGroup("/api").RequireAuthorization();
|
||||
PmsEndpoints.Map(api,preview);
|
||||
PaymentEndpoints.Map(api,preview);
|
||||
AutoReplyEndpoints.Map(api,preview);
|
||||
api.MapGet("/hotel", async (HttpContext c, CancellationToken _) => Results.Ok(await store.Get<Hotel>(Session.Hotel(c), Session.Hotel(c))));
|
||||
api.MapPut("/hotel", async (SettingsInput input, HttpContext c) =>
|
||||
{
|
||||
@@ -219,6 +221,12 @@ api.MapPost("/conversations/{id}/send", async (string id, SendInput input, HttpC
|
||||
if (!await store.Replace(item.HotelId, item.Id, input.Version, item)) return Input.Conflict();
|
||||
await Session.Audit(store, c, "Approved a saved reply for Gmail delivery"); return Results.Ok(item);
|
||||
});
|
||||
api.MapPost("/conversations/{id}/delivery/release",async(string id,VersionInput input,HttpContext c,AutoReplyWork work)=>
|
||||
{
|
||||
var item=await store.Get<Conversation>(Session.Hotel(c),id);if(item==null)return Results.NotFound();
|
||||
if(preview||!await work.ReturnToStaff(item,input.Version))return Input.Conflict();
|
||||
await Session.Audit(store,c,"Returned an unsubmitted automatic reply to staff review");return Results.Ok(item);
|
||||
});
|
||||
api.MapPost("/conversations/{id}/delivery/retry", async (string id, VersionInput input, HttpContext c) =>
|
||||
{
|
||||
var item = await store.Get<Conversation>(Session.Hotel(c), id); if (item == null) return Results.NotFound();
|
||||
|
||||
Reference in New Issue
Block a user