Skip to content

Commit 730cb8d

Browse files
authored
Merge pull request #213 from Tynab/develop
Develop
2 parents a611a94 + f9a77ef commit 730cb8d

File tree

25 files changed

+373
-144
lines changed

25 files changed

+373
-144
lines changed

.github/workflows/assign-reviewer.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# name: PR Reviewer Assignment and Auto-Merge Setup
2+
3+
# on:
4+
# pull_request:
5+
# types: [opened]
6+
7+
# jobs:
8+
# manage_pull_request:
9+
# runs-on: ubuntu-latest
10+
# permissions:
11+
# pull-requests: write
12+
# contents: write
13+
# steps:
14+
# - uses: actions/github-script@v6
15+
# with:
16+
# script: |
17+
# const reviewers = ['keannguyen1996', 'tl-haile', 'yami-nguyen'];
18+
# const prAuthor = context.payload.pull_request.user.login;
19+
# const filteredReviewers = reviewers.filter(reviewer => reviewer !== prAuthor);
20+
21+
# // Assign the PR creator as assignee
22+
# await github.rest.issues.addAssignees({
23+
# owner: context.repo.owner,
24+
# repo: context.repo.repo,
25+
# issue_number: context.payload.pull_request.number,
26+
# assignees: [prAuthor]
27+
# });
28+
29+
# // Assign reviewers if available
30+
# if (filteredReviewers.length > 0) {
31+
# await github.rest.pulls.requestReviewers({
32+
# owner: context.repo.owner,
33+
# repo: context.repo.repo,
34+
# pull_number: context.payload.pull_request.number,
35+
# reviewers: filteredReviewers
36+
# });
37+
38+
# // Enable auto-merge
39+
# try {
40+
# await github.rest.pulls.enableAutomerge({
41+
# owner: context.repo.owner,
42+
# repo: context.repo.repo,
43+
# pull_number: context.payload.pull_request.number
44+
# });
45+
# console.log('Auto-merge enabled successfully');
46+
# } catch (error) {
47+
# console.log('Auto-merge enablement failed:', error.message);
48+
# }
49+
# } else {
50+
# console.log('No available reviewers after excluding PR author');
51+
# }

host/YANLib.HttpApi.Host/Options/ConfigureSwaggerOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.OpenApi.Models;
66
using NUglify.Helpers;
77
using Swashbuckle.AspNetCore.SwaggerGen;
8+
using static System.DateTime;
89

910
namespace YANLib.Options;
1011

@@ -27,6 +28,10 @@ private OpenApiInfo CreateInfoForApiVersion(ApiVersionDescription description)
2728
{
2829
info.Description += " This API version has been deprecated.";
2930
}
31+
else
32+
{
33+
info.Description += $" Deployed At: {UtcNow:yyyy-MM-dd HH:mm:ss}";
34+
}
3035

3136
return info;
3237
}
Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using AutoMapper;
2+
using System;
23
using System.Collections.Generic;
34
using Volo.Abp.AutoMapper;
45
using YANLib.Dtos;
@@ -15,13 +16,37 @@ public sealed class DeveloperTypeAutoMapperProfile : Profile
1516
{
1617
public DeveloperTypeAutoMapperProfile()
1718
{
18-
_ = CreateMap<(long Id, DeveloperTypeCreateRequest Request), DeveloperType>()
19+
CreateMap<KeyValuePair<string, DeveloperTypeRedisDto?>, DeveloperTypeResponse?>().ConvertUsing(static (s, _) => s.Value.IsNull()
20+
? null
21+
: new DeveloperTypeResponse
22+
{
23+
Id = s.Key.Parse<long>(),
24+
Name = s.Value.Name,
25+
CreatedBy = s.Value.CreatedBy,
26+
CreatedAt = s.Value.CreatedAt,
27+
UpdatedBy = s.Value.UpdatedBy,
28+
UpdatedAt = s.Value.UpdatedAt,
29+
IsActive = s.Value.IsActive
30+
});
31+
32+
_ = CreateMap<DeveloperType, DeveloperTypeRedisDto>();
33+
34+
_ = CreateMap<DeveloperType, DeveloperTypeResponse>();
35+
36+
_ = CreateMap<(long Id, DeveloperTypeRedisDto Dto), DeveloperTypeResponse>()
1937
.ForMember(static d => d.Id, static o => o.MapFrom(static s => s.Id))
20-
.ForMember(static d => d.Name, static o => o.MapFrom(static s => s.Request.Name))
21-
.ForMember(static d => d.CreatedBy, static o => o.MapFrom(static s => s.Request.CreatedBy))
38+
.ForMember(static d => d.Name, static o => o.MapFrom(static s => s.Dto.Name))
39+
.ForMember(static d => d.CreatedBy, static o => o.MapFrom(static s => s.Dto.CreatedBy))
40+
.ForMember(static d => d.CreatedAt, static o => o.MapFrom(static s => s.Dto.CreatedAt))
41+
.ForMember(static d => d.UpdatedBy, static o => o.MapFrom(static s => s.Dto.UpdatedBy))
42+
.ForMember(static d => d.UpdatedAt, static o => o.MapFrom(static s => s.Dto.UpdatedAt))
43+
.ForMember(static d => d.IsActive, static o => o.MapFrom(static s => s.Dto.IsActive));
44+
45+
_ = CreateMap<DeveloperTypeCreateRequest, DeveloperType>()
2246
.ForMember(static d => d.CreatedAt, static o => o.MapFrom(static s => UtcNow))
2347
.ForMember(static d => d.IsActive, static o => o.MapFrom(static s => true))
2448
.ForMember(static d => d.IsDeleted, static o => o.MapFrom(static s => false))
49+
.Ignore(static d => d.Id)
2550
.Ignore(static d => d.UpdatedBy)
2651
.Ignore(static d => d.UpdatedAt);
2752

@@ -32,28 +57,11 @@ public DeveloperTypeAutoMapperProfile()
3257
.ForMember(static d => d.IsActive, static o => o.MapFrom(static s => s.Request.IsActive))
3358
.Ignore(static d => d.IsDeleted);
3459

35-
_ = CreateMap<DeveloperType, DeveloperTypeRedisDto>();
36-
37-
_ = CreateMap<(long Id, DeveloperTypeRedisDto Dto), DeveloperTypeResponse>()
60+
_ = CreateMap<(Guid Id, string UpdatedBy), DeveloperTypeDto>()
3861
.ForMember(static d => d.Id, static o => o.MapFrom(static s => s.Id))
39-
.ForMember(static d => d.Name, static o => o.MapFrom(static s => s.Dto.Name))
40-
.ForMember(static d => d.CreatedBy, static o => o.MapFrom(static s => s.Dto.CreatedBy))
41-
.ForMember(static d => d.CreatedAt, static o => o.MapFrom(static s => s.Dto.CreatedAt))
42-
.ForMember(static d => d.UpdatedBy, static o => o.MapFrom(static s => s.Dto.UpdatedBy))
43-
.ForMember(static d => d.UpdatedAt, static o => o.MapFrom(static s => s.Dto.UpdatedAt))
44-
.ForMember(static d => d.IsActive, static o => o.MapFrom(static s => s.Dto.IsActive));
45-
46-
CreateMap<KeyValuePair<string, DeveloperTypeRedisDto?>, DeveloperTypeResponse?>().ConvertUsing(static (s, _) => s.Value.IsNull()
47-
? null
48-
: new DeveloperTypeResponse
49-
{
50-
Id = s.Key.Parse<long>(),
51-
Name = s.Value.Name,
52-
CreatedBy = s.Value.CreatedBy,
53-
CreatedAt = s.Value.CreatedAt,
54-
UpdatedBy = s.Value.UpdatedBy,
55-
UpdatedAt = s.Value.UpdatedAt,
56-
IsActive = s.Value.IsActive
57-
});
62+
.ForMember(static d => d.UpdatedBy, static o => o.MapFrom(static s => s.UpdatedBy))
63+
.Ignore(static d => d.Name)
64+
.Ignore(static d => d.IsActive)
65+
.Ignore(static d => d.IsDeleted);
5866
}
5967
}

src/YANLib.Application/Validations/EcommerceValidation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public sealed class EcommerceValidator : AbstractValidator<EcommerceLoginRequest
1010
{
1111
public EcommerceValidator()
1212
{
13-
_ = RuleFor(static x => x.Username).NotNull().NotEmpty().WithErrorCode(BAD_REQUEST_USER_NAME).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST_USER_NAME);
13+
_ = RuleFor(static x => x.Username).NotNull().NotEmpty().WithErrorCode(BAD_REQUEST_USERNAME).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST_USERNAME);
1414
_ = RuleFor(static x => x.Password).NotNull().NotEmpty().WithErrorCode(BAD_REQUEST_PASSWORD).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST_PASSWORD);
1515
}
1616
}
@@ -22,7 +22,7 @@ public EcommerceValidators()
2222
_ = RuleFor(static x => x).NotNull().NotEmpty().WithErrorCode(BAD_REQUEST).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST);
2323
_ = RuleForEach(static s => s).SetValidator(new EcommerceValidator());
2424
_ = RuleFor(static x => x).Must(IsNotEmptyAndNull).WithErrorCode(BAD_REQUEST).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST);
25-
_ = RuleFor(static x => x).Must(UsernameIsNotWhiteSpace).WithErrorCode(BAD_REQUEST_USER_NAME).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST_USER_NAME);
25+
_ = RuleFor(static x => x).Must(UsernameIsNotWhiteSpace).WithErrorCode(BAD_REQUEST_USERNAME).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST_USERNAME);
2626
_ = RuleFor(static x => x).Must(PasswordIsNotWhiteSpace).WithErrorCode(BAD_REQUEST_PASSWORD).WithMessage(YANLibDomainErrorMessages.BAD_REQUEST_PASSWORD);
2727
}
2828

src/YANLib.Domain.Shared/Localization/YANLib/vi.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"culture": "vi",
33
"texts": {
44
"YANLib:400": "Dữ liệu truyền vào không hợp lệ!",
5-
"YANLib:410": " truyền vào không hợp lệ!",
5+
"YANLib:410": "Khóa truyền vào không hợp lệ!",
66
"YANLib:420": "Tên truyền vào không hợp lệ!",
77
"YANLib:430": "Mã định danh truyền vào không hợp lệ!",
88
"YANLib:440": "Điểm truyền vào không hợp lệ!",
9-
"YANLib:450": " hồ sơ lập trình viên truyền vào không hợp lệ!",
9+
"YANLib:450": "Khóa hồ sơ lập trình viên truyền vào không hợp lệ!",
1010
"YANLib:460": "Tên người dùng truyền vào không hợp lệ!",
1111
"YANLib:470": "Mật khẩu truyền vào không hợp lệ!",
1212
"YANLib:403": "Lỗi quy tắc!",
13-
"YANLib:413": " đã tồn tại!",
13+
"YANLib:413": "Khóa đã tồn tại!",
1414
"YANLib:423": "Mã định danh đã tồn tại!",
1515
"YANLib:404": "Không tìm thấy dữ liệu!",
1616
"YANLib:434": "Không tìm thấy chứng chỉ!",

src/YANLib.Domain.Shared/YANLibDomainErrorCodes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class YANLibDomainErrorCodes
88
public const string BAD_REQUEST_ID_CARD = "YANLib:430";
99
public const string BAD_REQUEST_GPA = "YANLib:440";
1010
public const string BAD_REQUEST_DEV_ID = "YANLib:450";
11-
public const string BAD_REQUEST_USER_NAME = "YANLib:460";
11+
public const string BAD_REQUEST_USERNAME = "YANLib:460";
1212
public const string BAD_REQUEST_PASSWORD = "YANLib:470";
1313

1414
public const string BUSINESS_ERROR = "YANLib:403";

src/YANLib.Domain.Shared/YANLibDomainErrorMessages.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
public static class YANLibDomainErrorMessages
44
{
55
public const string BAD_REQUEST = "Dữ liệu truyền vào không hợp lệ!";
6-
public const string BAD_REQUEST_ID = " truyền vào không hợp lệ!";
6+
public const string BAD_REQUEST_ID = "Khóa truyền vào không hợp lệ!";
77
public const string BAD_REQUEST_NAME = "Tên truyền vào không hợp lệ!";
88
public const string BAD_REQUEST_ID_CARD = "Mã định danh truyền vào không hợp lệ!";
99
public const string BAD_REQUEST_GPA = "Điểm truyền vào không hợp lệ!";
10-
public const string BAD_REQUEST_DEV_ID = " hồ sơ lập trình viên truyền vào không hợp lệ!";
11-
public const string BAD_REQUEST_USER_NAME = "Tên người dùng truyền vào không hợp lệ!";
10+
public const string BAD_REQUEST_DEV_ID = "Khóa hồ sơ lập trình viên truyền vào không hợp lệ!";
11+
public const string BAD_REQUEST_USERNAME = "Tên người dùng truyền vào không hợp lệ!";
1212
public const string BAD_REQUEST_PASSWORD = "Mật khẩu truyền vào không hợp lệ!";
1313

1414
public const string BUSINESS_ERROR = "Lỗi quy tắc!";
15-
public const string EXIST_ID = " đã tồn tại!";
15+
public const string EXIST_ID = "Khóa đã tồn tại!";
1616
public const string EXIST_ID_CARD = "Mã định danh đã tồn tại!";
1717

1818
public const string NOT_FOUND = "Không tìm thấy dữ liệu!";

src/YANLib.Domain/Entities/Developer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
using System;
2+
using System.ComponentModel.DataAnnotations.Schema;
23
using static System.Guid;
4+
using static YANLib.YANLibConsts.DbSchema;
35

46
namespace YANLib.Entities;
57

8+
[Table(nameof(Developer), Schema = Sample)]
69
public sealed class Developer : YANLibDomainEntity<Guid>
710
{
811
public Developer() => Id = NewGuid();

src/YANLib.Domain/Entities/DeveloperProject.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
using System;
2+
using System.ComponentModel.DataAnnotations.Schema;
23
using static System.Guid;
4+
using static YANLib.YANLibConsts.DbSchema;
35

46
namespace YANLib.Entities;
57

8+
[Table(nameof(DeveloperProject), Schema = Sample)]
69
public sealed class DeveloperProject : YANLibDomainEntity<Guid>
710
{
811
public DeveloperProject() => Id = NewGuid();

0 commit comments

Comments
 (0)