Skip to content

Commit 8399769

Browse files
authored
Merge pull request #310 from qccoders/develop
Prod deploy 1.1
2 parents c8debe6 + eda3750 commit 8399769

File tree

140 files changed

+10757
-9409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+10757
-9409
lines changed

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,15 @@ matrix:
8181
secure: Xd6dEKIV6PS8dpZnG234m0R/9OE0Niqz/1kxGDvH2k4sRY0l3yF4WGf3DPvxI5I0jRuJuA/bFgAcGkhvhUG2wmTUawM58TO4jnDkQlSlj5pXuGRiyJiSVxnanRSp63dbfNDM7KCw8M1Tw5XQXKZVUynzbne/EeYs/c+jyAIX8OMMyHMPm1wE5m/cYiAl97AePlLtJhFB0hxG4GbmzNqiBHSuppPViY63wnfv0sfs0leXnPZ9UNEahfbuuFWymZxvJTmpdD5/4UrAw68C7GH8IQ5Z+2oWIlooTteNiDyNiFzX4aCKZ6SfQJAH+HInpPDfR2LKi0xKChb2RLccvW3FnCENyEihNYmELE0uiGHrELBIBZXWFH/8qH+2+4nOWuhEGhmdywTOpIYdOrXTpwxsMCc+42eD12NNeGFRSoOu+nqsDl3ifI3C0ZYrKYb70i78IlAcnki68UwWhvJhSA9TymwXV4INhiiTE3TQhw9duwlwMnxk+PTIhBt2tEjggDIcjCc75r6GTYdhex/r/PEYBL24qVM82GHeOKz0u4Ew85XpU/W9BwKu7tFzI8pxow8F0UCoKkcqDfNioqFx91qmrimFh5Z0GAsh4honixBWqEzBhKRVBNkHVrJ23PxPQBoX8n7EI7ehXGPnb2rVvcSkoQkHsl8NmYZkjYviv2y9ezc=
8282
on:
8383
repo: qccoders/QCVOC
84-
branch: master
84+
branch: master
85+
- language: android
86+
stage: Android
87+
android:
88+
components:
89+
- build-tools-28.0.2
90+
- android-26
91+
- extra-google-google_play_services
92+
before_script:
93+
- cd mobile
94+
script:
95+
- ./gradlew --quiet build

api/QCVOC.Api/Scans/Controller/ScansController.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public IActionResult Scan([FromBody]ScanRequest scan)
102102
}
103103

104104
var veteran = VeteranRepository
105-
.GetAll(new VeteranFilters() { CardNumber = scan.CardNumber })
105+
.GetAll(new VeteranFilters() { CardNumber = scan.CardNumber, IncludePhotoBase64 = true })
106106
.SingleOrDefault();
107107

108108
if (veteran == default(Veteran))
@@ -128,15 +128,15 @@ public IActionResult Scan([FromBody]ScanRequest scan)
128128

129129
if (existingCheckIn == default(Scan))
130130
{
131-
return CreateScan(scanRecord);
131+
return CreateScan(scanRecord, veteran);
132132
}
133133
else if (existingCheckIn.PlusOne != scan.PlusOne)
134134
{
135-
return UpdateScan(scanRecord);
135+
return UpdateScan(scanRecord, veteran);
136136
}
137137
else
138138
{
139-
return StatusCode(200, existingCheckIn);
139+
return StatusCode(200, new ScanResponse(existingCheckIn, veteran));
140140
}
141141
}
142142

@@ -157,28 +157,28 @@ public IActionResult Scan([FromBody]ScanRequest scan)
157157
return StatusCode(200, previousScans.Where(s => s.ServiceId == scan.ServiceId).SingleOrDefault());
158158
}
159159

160-
return CreateScan(scanRecord);
160+
return CreateScan(scanRecord, veteran);
161161
}
162162

163-
private IActionResult CreateScan(Scan scan)
163+
private IActionResult CreateScan(Scan scan, Veteran veteran)
164164
{
165165
try
166166
{
167167
var createdScan = ScanRepository.Create(scan);
168-
return StatusCode(201, createdScan);
168+
return StatusCode(201, new ScanResponse(createdScan, veteran));
169169
}
170170
catch (Exception ex)
171171
{
172172
throw new Exception($"Error processing Scan: {ex.Message}. See inner Exception for details.", ex);
173173
}
174174
}
175175

176-
private IActionResult UpdateScan(Scan scan)
176+
private IActionResult UpdateScan(Scan scan, Veteran veteran)
177177
{
178178
try
179179
{
180180
var updatedScan = ScanRepository.Update(scan);
181-
return StatusCode(201, updatedScan);
181+
return StatusCode(201, new ScanResponse(updatedScan, veteran));
182182
}
183183
catch (Exception ex)
184184
{
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// <copyright file="ScanResponse.cs" company="QC Coders">
2+
// Copyright (c) QC Coders. All rights reserved. Licensed under the GPLv3 license. See LICENSE file
3+
// in the project root for full license information.
4+
// </copyright>
5+
6+
namespace QCVOC.Api.Scans.Data.DTO
7+
{
8+
using System;
9+
using QCVOC.Api.Scans.Data.Model;
10+
using QCVOC.Api.Veterans.Data.Model;
11+
12+
/// <summary>
13+
/// DTO containing the result of a Scan.
14+
/// </summary>
15+
public class ScanResponse
16+
{
17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="ScanResponse"/> class with the specified <paramref name="scan"/> and <paramref name="veteran"/>.
19+
/// </summary>
20+
/// <param name="scan">The Scan to include in the response.</param>
21+
/// <param name="veteran">The Veteran associated with the scan, if applicable.</param>
22+
public ScanResponse(Scan scan, Veteran veteran)
23+
{
24+
EventId = scan.EventId;
25+
VeteranId = scan.VeteranId;
26+
Veteran = veteran;
27+
ServiceId = scan.ServiceId;
28+
PlusOne = scan.PlusOne;
29+
ScanBy = scan.ScanBy;
30+
ScanById = scan.ScanById;
31+
ScanDate = scan.ScanDate;
32+
}
33+
34+
/// <summary>
35+
/// Gets or sets the id of the Event.
36+
/// </summary>
37+
public Guid EventId { get; set; }
38+
39+
/// <summary>
40+
/// Gets or sets the id of the Veteran.
41+
/// </summary>
42+
public Guid VeteranId { get; set; }
43+
44+
/// <summary>
45+
/// Gets or sets the Veteran associated with the Scan.
46+
/// </summary>
47+
public Veteran Veteran { get; set; }
48+
49+
/// <summary>
50+
/// Gets or sets the id of the Service.
51+
/// </summary>
52+
/// <remarks>
53+
/// If null, represents a check-in Scan.
54+
/// </remarks>
55+
public Guid ServiceId { get; set; }
56+
57+
/// <summary>
58+
/// Gets or sets a value indicating whether the Veteran brought a guest.
59+
/// </summary>
60+
public bool PlusOne { get; set; }
61+
62+
/// <summary>
63+
/// Gets or sets the name of the user who performed the Scan.
64+
/// </summary>
65+
public string ScanBy { get; set; }
66+
67+
/// <summary>
68+
/// Gets or sets the id of the user who performed the Scan.
69+
/// </summary>
70+
public Guid ScanById { get; set; }
71+
72+
/// <summary>
73+
/// Gets or sets the date on which the Scan was performed.
74+
/// </summary>
75+
public DateTime ScanDate { get; set; }
76+
}
77+
}

api/QCVOC.Api/Scans/Data/Model/Scan.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ public class Scan : IEquatable<Scan>
2222
/// </summary>
2323
public Guid VeteranId { get; set; }
2424

25-
/// <summary>
26-
/// Gets or sets the full name of the Veteran.
27-
/// </summary>
28-
public string Veteran { get; set; }
29-
3025
/// <summary>
3126
/// Gets or sets the id of the Service.
3227
/// </summary>

api/QCVOC.Api/Scans/Data/Repository/ScanRepository.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ public IEnumerable<Scan> GetAll(Filters filters = null)
137137
s.plusone,
138138
s.scandate,
139139
s.scanbyid,
140-
a.name AS scanby,
141-
v.firstname || ' ' || v.lastname AS veteran
140+
a.name AS scanby
142141
FROM scans s
143142
LEFT JOIN accounts a ON s.scanbyid = a.id
144143
INNER JOIN veterans v ON s.veteranid = v.id
@@ -162,8 +161,7 @@ LIMIT @limit OFFSET @offset
162161
.ApplyFilter(FilterType.Equals, "s.eventid", scanFilters.EventId)
163162
.ApplyFilter(FilterType.Equals, "s.veteranid", scanFilters.VeteranId)
164163
.ApplyFilter(FilterType.Equals, "s.serviceid", scanFilters.ServiceId)
165-
.ApplyFilter(FilterType.Equals, "s.plusone", scanFilters.PlusOne)
166-
.ApplyFilter(FilterType.Equals, "v.firstname || ' ' || v.lastname", scanFilters.Veteran);
164+
.ApplyFilter(FilterType.Equals, "s.plusone", scanFilters.PlusOne);
167165
}
168166

169167
using (var db = ConnectionFactory.CreateConnection())

api/QCVOC.Api/Scans/ScanFilters.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ public class ScanFilters : Filters
2525
/// </summary>
2626
public Guid? VeteranId { get; set; }
2727

28-
/// <summary>
29-
/// The full name of the Veteran.
30-
/// </summary>
31-
public string Veteran { get; set; }
32-
3328
/// <summary>
3429
/// The id of the Service.
3530
/// </summary>

api/QCVOC.Api/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,4 @@ private static string GetXmlCommentsFilePath()
267267
return Path.Combine(basePath, fileName);
268268
}
269269
}
270-
}
270+
}

api/QCVOC.Api/Veterans/Controller/VeteransController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace QCVOC.Api.Veterans.Controller
1010
using System.Linq;
1111
using Microsoft.AspNetCore.Authorization;
1212
using Microsoft.AspNetCore.Mvc;
13-
using Microsoft.AspNetCore.Mvc.ModelBinding;
1413
using QCVOC.Api.Common;
1514
using QCVOC.Api.Common.Data.Repository;
1615
using QCVOC.Api.Security;
@@ -144,6 +143,7 @@ public IActionResult Enroll([FromBody]VeteranEnrollRequest veteran)
144143
LastUpdateDate = DateTime.UtcNow,
145144
LastUpdateById = User.GetId(),
146145
CardNumber = veteran.CardNumber,
146+
PhotoBase64 = veteran.PhotoBase64,
147147
PrimaryPhone = veteran.PrimaryPhone,
148148
VerificationMethod = veteran.VerificationMethod,
149149
};
@@ -228,6 +228,7 @@ public IActionResult Update([FromRoute]Guid id, [FromBody]VeteranUpdateRequest v
228228
LastUpdateDate = DateTime.UtcNow,
229229
LastUpdateById = User.GetId(),
230230
CardNumber = veteran.CardNumber,
231+
PhotoBase64 = veteran.PhotoBase64,
231232
PrimaryPhone = veteran.PrimaryPhone,
232233
VerificationMethod = veteran.VerificationMethod,
233234
};
@@ -280,4 +281,4 @@ public IActionResult Delete([FromRoute]Guid id)
280281
}
281282
}
282283
}
283-
}
284+
}

api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,10 @@ public class VeteranEnrollRequest
5757
/// </summary>
5858
[Required]
5959
public VerificationMethod VerificationMethod { get; set; }
60+
61+
/// <summary>
62+
/// Gets or sets the photo of the veteran.
63+
/// </summary>
64+
public string PhotoBase64 { get; set; }
6065
}
61-
}
66+
}

api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,10 @@ public class VeteranUpdateRequest
5757
/// </summary>
5858
[Required]
5959
public VerificationMethod VerificationMethod { get; set; }
60+
61+
/// <summary>
62+
/// Gets or sets the photo of the veteran.
63+
/// </summary>
64+
public string PhotoBase64 { get; set; }
6065
}
61-
}
66+
}

api/QCVOC.Api/Veterans/Data/Model/Veteran.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public class Veteran : IEquatable<Veteran>
3737
/// </summary>
3838
public DateTime EnrollmentDate { get; set; }
3939

40+
/// <summary>
41+
/// Gets or sets the photo of the veteran.
42+
/// </summary>
43+
public string PhotoBase64 { get; set; }
44+
4045
/// <summary>
4146
/// Gets or sets the first name of the Veteran.
4247
/// </summary>
@@ -107,6 +112,7 @@ public bool Equals(Veteran veteran)
107112
&& this.LastUpdateById == veteran.LastUpdateById
108113
&& this.LastUpdateBy == veteran.LastUpdateBy
109114
&& this.Address == veteran.Address
115+
&& this.PhotoBase64 == veteran.PhotoBase64
110116
&& this.PrimaryPhone == veteran.PrimaryPhone
111117
&& this.Email == veteran.Email
112118
&& this.EnrollmentById == veteran.EnrollmentById
@@ -115,4 +121,4 @@ public bool Equals(Veteran veteran)
115121
&& this.EnrollmentDate - veteran.EnrollmentDate <= TimeSpan.FromSeconds(1);
116122
}
117123
}
118-
}
124+
}

api/QCVOC.Api/Veterans/Data/Repository/VeteranRepository.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ INSERT INTO veterans (
4848
lastupdatedate,
4949
lastupdatebyid,
5050
address,
51+
photobase64,
5152
primaryphone,
5253
email,
5354
enrollmentdate,
@@ -63,6 +64,7 @@ INSERT INTO veterans (
6364
@lastupdatedate,
6465
@lastupdatebyid,
6566
@address,
67+
@photobase64,
6668
@primaryphone,
6769
@email,
6870
@enrollmentdate,
@@ -81,6 +83,7 @@ INSERT INTO veterans (
8183
lastupdatedate = veteran.LastUpdateDate,
8284
lastupdatebyid = veteran.LastUpdateById,
8385
address = veteran.Address,
86+
photobase64 = veteran.PhotoBase64,
8487
primaryphone = veteran.PrimaryPhone,
8588
email = veteran.Email,
8689
enrollmentdate = veteran.EnrollmentDate,
@@ -107,7 +110,7 @@ public void Delete(Guid id)
107110

108111
var query = builder.AddTemplate(@"
109112
UPDATE veterans
110-
SET
113+
SET
111114
deleted = true,
112115
cardnumber = NULL
113116
WHERE id = @id
@@ -137,7 +140,7 @@ public void Delete(Veteran veteran)
137140
/// <returns>The Veteran matching the specified id.</returns>
138141
public Veteran Get(Guid id)
139142
{
140-
return GetAll(new VeteranFilters() { Id = id }).SingleOrDefault();
143+
return GetAll(new VeteranFilters() { Id = id, IncludePhotoBase64 = true }).SingleOrDefault();
141144
}
142145

143146
/// <summary>
@@ -160,14 +163,15 @@ public IEnumerable<Veteran> GetAll(Filters filters = null)
160163
a.name AS lastupdateby,
161164
v.lastupdatebyid,
162165
v.address,
166+
{(((VeteranFilters)filters).IncludePhotoBase64 ? "v.photobase64," : string.Empty)}
163167
v.primaryphone,
164168
v.email,
165169
v.enrollmentdate,
166170
v.enrollmentbyid,
167171
b.name AS enrollmentby,
168172
v.verificationmethod
169173
FROM veterans v
170-
LEFT JOIN accounts a ON v.lastupdatebyid = a.id
174+
LEFT JOIN accounts a ON v.lastupdatebyid = a.id
171175
LEFT JOIN accounts b ON v.enrollmentbyid = b.id
172176
/**where**/
173177
ORDER BY (firstname || lastname) {filters.OrderBy.ToString()}
@@ -220,6 +224,7 @@ UPDATE veterans
220224
lastupdatedate = @lastupdatedate,
221225
lastupdatebyid = @lastupdatebyid,
222226
address = @address,
227+
photobase64 = @photobase64,
223228
primaryphone = @primaryphone,
224229
email = @email,
225230
verificationmethod = @verificationmethod
@@ -234,6 +239,7 @@ UPDATE veterans
234239
lastupdatedate = veteran.LastUpdateDate,
235240
lastupdatebyid = veteran.LastUpdateById,
236241
address = veteran.Address,
242+
photobase64 = veteran.PhotoBase64,
237243
primaryPhone = veteran.PrimaryPhone,
238244
email = veteran.Email,
239245
id = veteran.Id,
@@ -248,4 +254,4 @@ UPDATE veterans
248254
return Get(veteran.Id);
249255
}
250256
}
251-
}
257+
}

api/QCVOC.Api/Veterans/VeteranFilters.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public class VeteranFilters : Filters
3535
/// </summary>
3636
public Guid? Id { get; set; }
3737

38+
/// <summary>
39+
/// A value indicating whether the PhotoBase64 data should be included in the results.
40+
/// </summary>
41+
public bool IncludePhotoBase64 { get; set; }
42+
3843
/// <summary>
3944
/// The last name of the Veteran.
4045
/// </summary>

mobile-new/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

mobile-new/app/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)