Parcourir la source

新增添加志愿者接口

qinchaoyue il y a 4 mois
Parent
commit
fafad37346

+ 1 - 6
src/Hotline.Application.Tests/Application/SnapshotApplicationTest.cs

@@ -242,6 +242,7 @@ public class SnapshotApplicationTest : TestBase
     [Fact]
     public async Task AddVolunteerReport_Test()
     {
+        await _snapshotApplication.AddVolunteerAsync(new AddVolunteerInDto {Name = _sessionContext.UserName, PhoneNumber = _sessionContext.Phone }, CancellationToken.None);
         var inDto = _fixture.Create<AddVolunteerReportInDto>();
         foreach (var item in inDto.Files)
         {
@@ -308,12 +309,6 @@ public class SnapshotApplicationTest : TestBase
         detail.Content.ShouldNotBeNullOrEmpty();
     }
 
-    [Fact]
-    public async Task InitRedPackDataAsync()
-    {
-       
-    }
-
     /// <summary>
     /// 测试行业
     /// 测试添加数据是否和获取的数据一致

+ 8 - 0
src/Hotline.Application/Snapshot/ISnapshotApplication.cs

@@ -139,6 +139,14 @@ public interface ISnapshotApplication
     /// <returns></returns>
     Task AddPractitionerAsync(IList<AddPractitionerInDto> dtos);
 
+    /// <summary>
+    /// 添加志愿者
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    Task<string> AddVolunteerAsync(AddVolunteerInDto dto, CancellationToken cancellationToken);
+
     /// <summary>
     /// 志愿者上报
     /// </summary>

+ 1 - 0
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -550,6 +550,7 @@ public abstract class SnapshotApplicationBase
     public async Task<string> AddVolunteerAsync(AddVolunteerInDto dto, CancellationToken cancellationToken)
     {
         var entity = dto.Adapt<Volunteer>();
+        entity.Id = await _volunteerRepository.AddAsync(entity);
         return entity.Id;
     }