WIP
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using ROLAC.API.DTOs.Giving;
|
||||
using ROLAC.API.DTOs.Members;
|
||||
using ROLAC.API.Hubs;
|
||||
using ROLAC.API.Services;
|
||||
|
||||
@@ -20,15 +21,18 @@ public class OfferingEntryController : ControllerBase
|
||||
{
|
||||
private readonly IOfferingSessionService _sessions;
|
||||
private readonly IGivingCategoryService _categories;
|
||||
private readonly IMemberService _members;
|
||||
private readonly IHubContext<OfferingEntryHub> _hub;
|
||||
|
||||
public OfferingEntryController(
|
||||
IOfferingSessionService sessions,
|
||||
IGivingCategoryService categories,
|
||||
IMemberService members,
|
||||
IHubContext<OfferingEntryHub> hub)
|
||||
{
|
||||
_sessions = sessions;
|
||||
_categories = categories;
|
||||
_members = members;
|
||||
_hub = hub;
|
||||
}
|
||||
|
||||
@@ -47,6 +51,31 @@ public class OfferingEntryController : ControllerBase
|
||||
public async Task<IActionResult> SearchMembers([FromQuery] string? search, [FromQuery] int take = 10)
|
||||
=> Ok(await _sessions.SearchMembersForEntryAsync(search, Math.Clamp(take, 1, 25)));
|
||||
|
||||
// Quick-add a giver who isn't on file yet (created as a Visitor). Reuses the
|
||||
// member service directly — role checks live on MembersController, so this
|
||||
// anonymous path is the intended public entry point for the mobile page.
|
||||
[HttpPost("members")]
|
||||
public async Task<IActionResult> QuickAddMember([FromBody] QuickAddMemberRequest request)
|
||||
{
|
||||
var id = await _members.CreateAsync(new CreateMemberRequest
|
||||
{
|
||||
FirstName_en = request.FirstName_en,
|
||||
LastName_en = request.LastName_en,
|
||||
NickName = request.NickName,
|
||||
FirstName_zh = request.FirstName_zh,
|
||||
LastName_zh = request.LastName_zh,
|
||||
PhoneCell = request.PhoneCell,
|
||||
Status = "Visitor",
|
||||
Country = "USA",
|
||||
LanguagePreference = "en",
|
||||
});
|
||||
return Ok(new MemberTypeaheadDto
|
||||
{
|
||||
Id = id, NickName = request.NickName,
|
||||
FirstName_en = request.FirstName_en, LastName_en = request.LastName_en,
|
||||
});
|
||||
}
|
||||
|
||||
// Append one offering line to the date's session (find-or-create), then
|
||||
// broadcast it to everyone viewing that date.
|
||||
[HttpPost("lines")]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace ROLAC.API.DTOs.Giving;
|
||||
|
||||
// Minimal member fields the mobile offering-entry page collects when a giver
|
||||
// isn't on file yet. Creates a Visitor; the rest of the profile can be filled
|
||||
// in later from the admin Members page.
|
||||
public class QuickAddMemberRequest
|
||||
{
|
||||
[Required, MaxLength(100)] public string FirstName_en { get; set; } = "";
|
||||
[Required, MaxLength(100)] public string LastName_en { get; set; } = "";
|
||||
[MaxLength(100)] public string? NickName { get; set; }
|
||||
[MaxLength(100)] public string? FirstName_zh { get; set; }
|
||||
[MaxLength(100)] public string? LastName_zh { get; set; }
|
||||
[MaxLength(30)] public string? PhoneCell { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user