Skip to content

Commit 63c4600

Browse files
Merge branch 'feature/issue-2299' of https://github.com/ita-social-projects/StreetCode into feature/issue-2299
2 parents b40fbdb + 6a89209 commit 63c4600

File tree

409 files changed

+22406
-6424
lines changed

Some content is hidden

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

409 files changed

+22406
-6424
lines changed

Jenkinsfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ pipeline {
8484
steps {
8585
parallel(
8686
Unit_test: {
87-
sh 'dotnet test ./Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj --configuration Release'
87+
sh 'dotnet test ./Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj --configuration Release --no-build'
8888
},
8989
Integration_test: {
90-
sh 'dotnet test ./Streetcode/Streetcode.XIntegrationTest/Streetcode.XIntegrationTest.csproj --configuration Release'
90+
sh 'dotnet test ./Streetcode/Streetcode.XIntegrationTest/Streetcode.XIntegrationTest.csproj --configuration Release --no-build'
9191
}
9292
)
9393
}
@@ -116,8 +116,8 @@ pipeline {
116116
/d:sonar.pullrequest.branch=$PR_BRANCH \
117117
/d:sonar.pullrequest.base=$PR_BASE
118118
119-
dotnet build ./Streetcode/Streetcode.sln --configuration Release
120-
dotnet-coverage collect "dotnet test ./Streetcode/Streetcode.sln --configuration Release" -f xml -o "coverage.xml"
119+
dotnet build ./Streetcode/Streetcode.sln --configuration Release -p:WarningLevel=0
120+
dotnet-coverage collect "dotnet test ./Streetcode/Streetcode.sln --configuration Release --no-build" -f xml -o "coverage.xml"
121121
dotnet sonarscanner end /d:sonar.token=$SONAR
122122
'''
123123
} else {
@@ -129,8 +129,8 @@ pipeline {
129129
/d:sonar.host.url="https://sonarcloud.io" \
130130
/d:sonar.cs.vscoveragexml.reportsPaths="**/coverage.xml" \
131131
132-
dotnet build ./Streetcode/Streetcode.sln --configuration Release
133-
dotnet-coverage collect "dotnet test ./Streetcode/Streetcode.sln --configuration Release" -f xml -o "coverage.xml"
132+
dotnet build ./Streetcode/Streetcode.sln --configuration Release -p:WarningLevel=0
133+
dotnet-coverage collect "dotnet test ./Streetcode/Streetcode.sln --configuration Release --no-build" -f xml -o "coverage.xml"
134134
dotnet sonarscanner end /d:sonar.token=$SONAR
135135
'''
136136
}

Streetcode/DbUpdate/DbUpdate.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
</ItemGroup>
24+
</ItemGroup>
2525

2626
<ItemGroup>
2727
<ProjectReference Include="..\Streetcode.WebApi\Streetcode.WebApi.csproj" />

Streetcode/Streetcode.BLL/Attributes/Authentication/ValidEmailAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Streetcode.BLL.Attributes.Authentication
55
{
6+
[AttributeUsage(AttributeTargets.Property)]
67
public class ValidEmailAttribute : ValidationAttribute
78
{
89
protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
@@ -19,7 +20,7 @@ public class ValidEmailAttribute : ValidationAttribute
1920
return new ValidationResult("Attribute cannot be applied to non-string property");
2021
}
2122

22-
if (!Regex.IsMatch(email, @"^[^@\s]+@[^@\s]+\.(com|net|org|gov|ua)$", RegexOptions.None, TimeSpan.FromMilliseconds(100)))
23+
if (!Regex.IsMatch(email, @"^(?!.*\.\.)[a-zA-Z0-9_%+-]+(?:\.[a-zA-Z0-9_%+-]+)*@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$", RegexOptions.None, TimeSpan.FromMilliseconds(100)))
2324
{
2425
return new ValidationResult("Incorrect email address format");
2526
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Streetcode.BLL.DTO.Authentication.GoogleLogin
2+
{
3+
public class GoogleLoginRequest
4+
{
5+
public string IdToken { get; set; } = string.Empty;
6+
}
7+
}

Streetcode/Streetcode.BLL/DTO/Authentication/Login/LoginRequestDTO.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
using System.ComponentModel;
22
using System.ComponentModel.DataAnnotations;
33
using Streetcode.BLL.Constants.Authentication;
4+
using Streetcode.BLL.Attributes.Authentication;
45

56
namespace Streetcode.BLL.DTO.Authentication.Login;
67

78
public class LoginRequestDTO
89
{
910
[Required]
10-
[EmailAddress]
11+
[ValidEmail]
1112
[DefaultValue(AuthConstants.Email)]
1213
public string Login { get; set; } = null!;
1314

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
1-
using System.ComponentModel;
2-
using System.ComponentModel.DataAnnotations;
1+
using System.ComponentModel.DataAnnotations;
32
using Streetcode.BLL.Attributes.Authentication;
4-
using Streetcode.BLL.Constants.Authentication;
53

64
namespace Streetcode.BLL.DTO.Authentication.Register;
75

86
public class RegisterRequestDTO
97
{
108
[Required]
119
[MaxLength(50)]
12-
[DefaultValue(AuthConstants.Name)]
1310
public string Name { get; set; } = null!;
1411

1512
[Required]
1613
[MaxLength(50)]
17-
[DefaultValue(AuthConstants.Surname)]
1814
public string Surname { get; set; } = null!;
1915

2016
[Required]
21-
[EmailAddress]
22-
[DefaultValue(AuthConstants.Email)]
23-
[RegularExpression(@"[^\.\-_](?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])", ErrorMessage = "The Email field doesn't contain a valid email address")]
17+
[ValidEmail]
2418
public string Email { get; set; } = null!;
2519

2620
[Required]
2721
[MaxLength(30, ErrorMessage = "Password maximum length is 30")]
2822
[StrongPassword]
29-
[DefaultValue(AuthConstants.Password)]
3023
public string Password { get; set; } = null!;
3124

3225
[Required]
3326
[Display(Name = "Confirm password")]
3427
[MaxLength(30, ErrorMessage = "Password maximum length is 30")]
35-
[DefaultValue("")]
3628
[Compare(nameof(Password))]
3729
public string PasswordConfirmation { get; set; } = null!;
3830
}

Streetcode/Streetcode.BLL/DTO/Streetcode/Create/StreetcodeCreateDTO.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,40 @@
33
using Streetcode.BLL.DTO.AdditionalContent.Tag;
44
using Streetcode.BLL.DTO.Analytics;
55
using Streetcode.BLL.DTO.Media.Video;
6-
using Streetcode.BLL.DTO.Partners;
76
using Streetcode.BLL.DTO.Sources;
87
using Streetcode.BLL.DTO.Streetcode.RelatedFigure;
98
using Streetcode.BLL.DTO.Streetcode.TextContent.Fact;
109
using Streetcode.BLL.DTO.Streetcode.TextContent.Text;
1110

12-
namespace Streetcode.BLL.DTO.Streetcode.Create
11+
namespace Streetcode.BLL.DTO.Streetcode.Create;
12+
13+
public class StreetcodeCreateDTO : StreetcodeCreateUpdateDTO
1314
{
14-
public class StreetcodeCreateDTO : StreetcodeCreateUpdateDTO
15-
{
16-
public string? ARBlockURL { get; set; }
17-
public int ViewCount { get; set; }
18-
public TextCreateDTO? Text { get; set; }
19-
public int? AudioId { get; set; }
20-
public IEnumerable<int> ImagesIds { get; set; } = null!; // one image black and white is required at front-end side, so at least one will be passed
21-
public IEnumerable<StreetcodeTagDTO> Tags { get; set; } = null!;
22-
public IEnumerable<SubtitleCreateDTO> Subtitles { get; set; } = null!; // subtitles are only in one example
23-
public IEnumerable<StreetcodeFactCreateDTO> Facts { get; set; } = null!;
24-
public IEnumerable<VideoCreateDTO>? Videos { get; set; } = null!; // video is only one
25-
public IEnumerable<RelatedFigureShortDTO> RelatedFigures { get; set; } = null!;
26-
public IEnumerable<int> Partners { get; set; } = null!;
27-
public IEnumerable<CategoryContentCreateDTO> StreetcodeCategoryContents { get; set; } = null!;
28-
public IEnumerable<StreetcodeCoordinateDTO> Coordinates { get; set; } = null!;
29-
public IEnumerable<StatisticRecordDTO> StatisticRecords { get; set; } = null!;
30-
}
31-
}
15+
public string? ArBlockUrl { get; set; }
16+
17+
public int ViewCount { get; set; }
18+
19+
public TextCreateDTO? Text { get; set; }
20+
21+
public int? AudioId { get; set; }
22+
23+
public IEnumerable<int> ImagesIds { get; set; } = new List<int>();
24+
25+
public IEnumerable<StreetcodeTagDTO>? Tags { get; set; } = new List<StreetcodeTagDTO>();
26+
27+
public IEnumerable<SubtitleCreateDTO>? Subtitles { get; set; } = new List<SubtitleCreateDTO>();
28+
29+
public IEnumerable<StreetcodeFactCreateDTO>? Facts { get; set; } = new List<StreetcodeFactCreateDTO>();
30+
31+
public IEnumerable<VideoCreateDTO>? Videos { get; set; } = new List<VideoCreateDTO>();
32+
33+
public IEnumerable<RelatedFigureShortDTO>? RelatedFigures { get; set; } = new List<RelatedFigureShortDTO>();
34+
35+
public IEnumerable<int>? Partners { get; set; } = new List<int>();
36+
37+
public IEnumerable<CategoryContentCreateDTO>? StreetcodeCategoryContents { get; set; } = new List<CategoryContentCreateDTO>();
38+
39+
public IEnumerable<StreetcodeCoordinateDTO>? Coordinates { get; set; } = new List<StreetcodeCoordinateDTO>();
40+
41+
public IEnumerable<StatisticRecordDTO>? StatisticRecords { get; set; } = new List<StatisticRecordDTO>();
42+
}
Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
2-
using Streetcode.BLL.DTO.Media.Art;
1+
using Streetcode.BLL.DTO.Media.Art;
32
using Streetcode.BLL.DTO.Media.Create;
43
using Streetcode.BLL.DTO.Media.Images;
54
using Streetcode.BLL.DTO.Timeline.Update;
@@ -11,20 +10,36 @@ namespace Streetcode.BLL.DTO.Streetcode;
1110
public abstract class StreetcodeCreateUpdateDTO
1211
{
1312
public string? FirstName { get; set; }
13+
1414
public string? LastName { get; set; }
15+
1516
public int Index { get; set; }
16-
public string? Teaser { get; set; } // in the requirements it's not specified whether it is a mandatory property or not
17-
public string DateString { get; set; } = null!; // date in a pretty format
18-
public string? Alias { get; set; } // this is "Короткий опис (для зв'язків історії)"
19-
public StreetcodeStatus Status { get; set; } // passed as a number
20-
public StreetcodeType StreetcodeType { get; set; } // an event or a person
21-
public string Title { get; set; } = null!; // this is "Назва стріткоду"
22-
public string TransliterationUrl { get; set; } = null!; // this is "URL"
17+
18+
public string? Teaser { get; set; }
19+
20+
public string DateString { get; set; } = null!;
21+
22+
public string? Alias { get; set; }
23+
24+
public StreetcodeStatus Status { get; set; }
25+
26+
public StreetcodeType StreetcodeType { get; set; }
27+
28+
public string Title { get; set; } = null!;
29+
30+
public string TransliterationUrl { get; set; } = null!;
31+
2332
public DateTime EventStartOrPersonBirthDate { get; set; }
33+
2434
public DateTime? EventEndOrPersonDeathDate { get; set; }
25-
public IEnumerable<StreetcodeToponymCreateUpdateDTO> Toponyms { get; set; } = null!;
26-
public IEnumerable<TimelineItemCreateUpdateDTO> TimelineItems { get; set; } = null!;
27-
public IEnumerable<ImageDetailsDto>? ImagesDetails { get; set; } // strange behaviour, a random number is passed as 'Alt' property
28-
public IEnumerable<StreetcodeArtSlideCreateUpdateDTO> StreetcodeArtSlides { get; set; } = null!;
29-
public List<ArtCreateUpdateDTO> Arts { get; set; } = null!;
35+
36+
public IEnumerable<StreetcodeToponymCreateUpdateDTO>? Toponyms { get; set; } = new List<StreetcodeToponymCreateUpdateDTO>();
37+
38+
public IEnumerable<TimelineItemCreateUpdateDTO>? TimelineItems { get; set; } = new List<TimelineItemCreateUpdateDTO>();
39+
40+
public IEnumerable<ImageDetailsDto> ImagesDetails { get; set; } = new List<ImageDetailsDto>();
41+
42+
public IEnumerable<StreetcodeArtSlideCreateUpdateDTO>? StreetcodeArtSlides { get; set; } = new List<StreetcodeArtSlideCreateUpdateDTO>();
43+
44+
public List<ArtCreateUpdateDTO>? Arts { get; set; } = new List<ArtCreateUpdateDTO>();
3045
}
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
namespace Streetcode.BLL.DTO.Streetcode.TextContent.Fact
1+
namespace Streetcode.BLL.DTO.Streetcode.TextContent.Fact;
2+
3+
public abstract class FactUpdateCreateDto
24
{
3-
public abstract class FactUpdateCreateDto
4-
{
5-
public string Title { get; set; }
6-
public int ImageId { get; set; }
7-
public string FactContent { get; set; }
8-
public int Index { get; set; }
9-
public string? ImageDescription { get; set; }
10-
}
11-
}
5+
public string Title { get; set; }
6+
7+
public int ImageId { get; set; }
8+
9+
public string FactContent { get; set; }
10+
11+
public int StreetcodeId { get; set; }
12+
13+
public int Index { get; set; }
14+
15+
public string? ImageDescription { get; set; }
16+
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using Streetcode.BLL.DTO.Streetcode.Update.Interfaces;
22
using Streetcode.BLL.Enums;
33

4-
namespace Streetcode.BLL.DTO.Streetcode.TextContent.Fact
4+
namespace Streetcode.BLL.DTO.Streetcode.TextContent.Fact;
5+
6+
public class StreetcodeFactUpdateDTO : FactUpdateCreateDto, IModelState
57
{
6-
public class StreetcodeFactUpdateDTO : FactUpdateCreateDto, IModelState
7-
{
88
public int Id { get; set; }
9+
910
public ModelState ModelState { get; set; }
10-
public int StreetcodeId { get; set; }
11-
}
1211
}

0 commit comments

Comments
 (0)