Skip to content

Commit 6499644

Browse files
authored
Merge pull request #689 from bcgov/yj
chore: subsidiary platform
2 parents 3e6f546 + 277f735 commit 6499644

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

postman/str-dss.postman_collection.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@
16261626
"header": [],
16271627
"body": {
16281628
"mode": "raw",
1629-
"raw": "{\r\n \"organizationId\": 0,\r\n \"organizationCd\": \"TESTCD2\",\r\n \"organizationNm\": \"TEST ORG 2\",\r\n \"updDtm\": \"2024-09-27T16:31:12.047Z\",\r\n \"primaryNoticeOfTakedownContactEmail\": \"email1@email.com\",\r\n \"primaryTakedownRequestContactEmail\": \"email2@email.com\",\r\n \"secondaryNoticeOfTakedownContactEmail\": \"email2@email.com\",\r\n \"secondaryTakedownRequestContactEmail\": \"email2@email.com\"\r\n}",
1629+
"raw": "{\r\n \"organizationId\": 0,\r\n \"organizationCd\": \"TESTCD3\",\r\n \"organizationNm\": \"TEST ORG 3\",\r\n \"updDtm\": \"2024-09-27T16:31:12.047Z\",\r\n \"primaryNoticeOfTakedownContactEmail\": \"email1@email.com\",\r\n \"primaryTakedownRequestContactEmail\": \"email2@email.com\",\r\n \"secondaryNoticeOfTakedownContactEmail\": \"email2@email.com\",\r\n \"secondaryTakedownRequestContactEmail\": \"email2@email.com\"\r\n}",
16301630
"options": {
16311631
"raw": {
16321632
"language": "json"
@@ -1683,7 +1683,7 @@
16831683
"header": [],
16841684
"body": {
16851685
"mode": "raw",
1686-
"raw": "{\r\n \"organizationNm\": \"TEST ORG11\",\r\n \"updDtm\": \"2024-09-27T18:21:49.159676Z\",\r\n \"primaryNoticeOfTakedownContactEmail\": \"email1@email.com\",\r\n \"primaryTakedownRequestContactEmail\": \"email2@email.com\",\r\n \"secondaryNoticeOfTakedownContactEmail\": \"email2@email.com\",\r\n \"secondaryTakedownRequestContactEmail\": \"email2@email.com\"\r\n}",
1686+
"raw": "{\r\n \"organizationNm\": \"TEST ORG11\",\r\n \"updDtm\": \"2024-09-27T18:21:49.159676Z\",\r\n \"primaryNoticeOfTakedownContactEmail\": \"email2@email.com\",\r\n \"primaryTakedownRequestContactEmail\": \"email2@email.com\",\r\n \"secondaryNoticeOfTakedownContactEmail\": \"email2@email.com\",\r\n \"secondaryTakedownRequestContactEmail\": \"email2@email.com\"\r\n}",
16871687
"options": {
16881688
"raw": {
16891689
"language": "json"

server/StrDss.Common/Constants.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ public static class PlatformFields
112112
public const string OrganizationId = "OrganizationId";
113113
public const string OrganizationCd = "OrganizationCd";
114114
public const string OrganizationNm = "OrganizationNm";
115-
public const string NoticeOfTakedownContactEmail1 = "NoticeOfTakedownContactEmail1";
116-
public const string TakedownRequestContactEmail1 = "TakedownRequestContactEmail1";
117-
public const string NoticeOfTakedownContactEmail2 = "NoticeOfTakedownContactEmail2";
118-
public const string TakedownRequestContactEmail2 = "TakedownRequestContactEmail2";
115+
public const string PrimaryNoticeOfTakedownContactEmail = "PrimaryNoticeOfTakedownContactEmail";
116+
public const string PrimaryTakedownRequestContactEmail = "PrimaryTakedownRequestContactEmail";
117+
public const string SecondaryNoticeOfTakedownContactEmail = "SecondaryNoticeOfTakedownContactEmail";
118+
public const string SecondaryTakedownRequestContactEmail = "SecondaryTakedownRequestContactEmail";
119119
}
120120

121121
public static class RentalListingExport

server/StrDss.Service/OrganizationService.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public async Task<PagedDto<PlatformViewDto>> GetPlatforms(int pageSize, int page
8282
{
8383
var errors = new Dictionary<string, List<string>>();
8484

85-
await ValidatePlatformCreateDto(dto, errors);
85+
await ValidatePlatformCreateDto<PlatformCreateDto>(dto, errors);
8686

8787
if (errors.Any())
8888
{
@@ -93,12 +93,13 @@ public async Task<PagedDto<PlatformViewDto>> GetPlatforms(int pageSize, int page
9393

9494
_unitOfWork.Commit();
9595

96-
return (errors, entity.OrganizationId);
96+
return (errors, entity.OrganizationId);
9797
}
9898

99-
private async Task<Dictionary<string, List<string>>> ValidatePlatformCreateDto(IPlatformCreateDto dto, Dictionary<string, List<string>> errors)
99+
private async Task<Dictionary<string, List<string>>> ValidatePlatformCreateDto<T>(IPlatformCreateDto dto, Dictionary<string, List<string>> errors)
100+
where T : class, IPlatformCreateDto
100101
{
101-
_validator.Validate(Entities.Platform, dto, errors);
102+
_validator.Validate(Entities.Platform, (T)dto, errors);
102103

103104
if (errors.Any())
104105
{
@@ -117,7 +118,7 @@ public async Task<Dictionary<string, List<string>>> UpdatePlatformAsync(Platform
117118
{
118119
var errors = new Dictionary<string, List<string>>();
119120

120-
await ValidatePlatformUpdateDto(dto, errors);
121+
await ValidatePlatformUpdateDto<PlatformUpdateDto>(dto, errors);
121122

122123
if (errors.Any())
123124
{
@@ -131,7 +132,8 @@ public async Task<Dictionary<string, List<string>>> UpdatePlatformAsync(Platform
131132
return errors;
132133
}
133134

134-
private async Task<Dictionary<string, List<string>>> ValidatePlatformUpdateDto(IPlatformUpdateDto dto, Dictionary<string, List<string>> errors)
135+
private async Task<Dictionary<string, List<string>>> ValidatePlatformUpdateDto<T>(IPlatformUpdateDto dto, Dictionary<string, List<string>> errors)
136+
where T : class, IPlatformUpdateDto
135137
{
136138
var platformDto = await _orgRepo.GetPlatform(dto.OrganizationId);
137139

@@ -141,7 +143,7 @@ private async Task<Dictionary<string, List<string>>> ValidatePlatformUpdateDto(I
141143
return errors;
142144
}
143145

144-
_validator.Validate(Entities.Platform, dto, errors);
146+
_validator.Validate(Entities.Platform, (T)dto, errors);
145147

146148
return errors;
147149
}
@@ -157,7 +159,7 @@ private async Task<Dictionary<string, List<string>>> ValidatePlatformUpdateDto(I
157159
return (errors, 0);
158160
}
159161

160-
await ValidatePlatformCreateDto(dto, errors);
162+
await ValidatePlatformCreateDto<PlatformCreateDto>(dto, errors);
161163

162164
if (errors.Any())
163165
{
@@ -205,7 +207,7 @@ public async Task<Dictionary<string, List<string>>> UpdatePlatformSubAsync(Platf
205207
return errors;
206208
}
207209

208-
await ValidatePlatformUpdateDto(dto, errors);
210+
await ValidatePlatformUpdateDto<PlatformSubUpdateDto>(dto, errors);
209211

210212
if (errors.Any())
211213
{

server/StrDss.Service/PlatformValidationRule.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void LoadPlatformUpdateValidationRules(List<FieldValidationRule> r
2929
rules.Add(new FieldValidationRule
3030
{
3131
EntityName = Entities.Platform,
32-
FieldName = PlatformFields.NoticeOfTakedownContactEmail1,
32+
FieldName = PlatformFields.PrimaryNoticeOfTakedownContactEmail,
3333
FieldType = FieldTypes.String,
3434
Required = true,
3535
MaxLength = 320,
@@ -39,7 +39,7 @@ public static void LoadPlatformUpdateValidationRules(List<FieldValidationRule> r
3939
rules.Add(new FieldValidationRule
4040
{
4141
EntityName = Entities.Platform,
42-
FieldName = PlatformFields.TakedownRequestContactEmail1,
42+
FieldName = PlatformFields.PrimaryTakedownRequestContactEmail,
4343
FieldType = FieldTypes.String,
4444
Required = true,
4545
MaxLength = 320,
@@ -49,7 +49,7 @@ public static void LoadPlatformUpdateValidationRules(List<FieldValidationRule> r
4949
rules.Add(new FieldValidationRule
5050
{
5151
EntityName = Entities.Platform,
52-
FieldName = PlatformFields.NoticeOfTakedownContactEmail2,
52+
FieldName = PlatformFields.SecondaryNoticeOfTakedownContactEmail,
5353
FieldType = FieldTypes.String,
5454
Required = false,
5555
MaxLength = 320,
@@ -59,7 +59,7 @@ public static void LoadPlatformUpdateValidationRules(List<FieldValidationRule> r
5959
rules.Add(new FieldValidationRule
6060
{
6161
EntityName = Entities.Platform,
62-
FieldName = PlatformFields.TakedownRequestContactEmail2,
62+
FieldName = PlatformFields.SecondaryTakedownRequestContactEmail,
6363
FieldType = FieldTypes.String,
6464
Required = false,
6565
MaxLength = 320,

0 commit comments

Comments
 (0)