From 9376c4b14ea8f3cf3d2687f17998501648dac67c Mon Sep 17 00:00:00 2001 From: Yosheng Date: Sat, 5 Aug 2023 17:33:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(CI):=20=E6=B5=8B=E8=AF=95=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=88=B0Nexus3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 32 ++++++++++++++----- .../Services/UserService.cs | 6 ++-- .../UserConfiguration.cs | 4 +-- .../UserPointManagementDbContext.cs | 4 +-- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.drone.yml b/.drone.yml index 646918f..6a339bb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,8 +1,24 @@ -kind: pipeline # 定义一个管道 -type: docker # 当前管道的类型 -name: test # 当前管道的名称 -steps: # 定义管道的执行步骤 - - name: test # 步骤名称 - image: node:latest # 当前步骤使用的镜像 - commands: # 当前步骤执行的命令 - - echo 测试drone执行 \ No newline at end of file +kind: pipeline +type: docker +name: deployment +steps: + - name: check + image: alpine + commands: + - ls -la + - ls -la Dockerfile --查看当前文件夹是否包含了Dockerfile + - name: publish + image: plugins/docker + settings: + dockerfile: Dockerfile + tags: latest + # you need insecure: true since we don't have a TLS certificate + insecure: true + registry: 192.168.31.104:8082 + repo: 192.168.31.104:8082/tiamo/user-point-management + # create the docker_username and docker_password secrets in Drone, with Nexus' username & password + secrets: [ drone, dronepw ] + +#trigger: +# branch: +# - master \ No newline at end of file diff --git a/src/UserPointManagement.Application/Services/UserService.cs b/src/UserPointManagement.Application/Services/UserService.cs index 00b86a6..46b4921 100644 --- a/src/UserPointManagement.Application/Services/UserService.cs +++ b/src/UserPointManagement.Application/Services/UserService.cs @@ -37,7 +37,7 @@ public class UserService : IUserService queryable = queryable.Where(x => x.Mobile.Contains(req.Keyword) || x.Name.Contains(req.Keyword), !string.IsNullOrEmpty(req.Keyword)); - + var count = queryable.Count(); var data = await queryable.OrderByDescending(x => x.Id).Paging(req).ToListAsync().ConfigureAwait(false); @@ -63,7 +63,8 @@ public class UserService : IUserService public async Task CreateUser(User input) { await using var _userPointManagementDbContext = await _dbContextFactory.CreateDbContextAsync(); - if (!string.IsNullOrWhiteSpace(input.Mobile) && _userPointManagementDbContext.Users.Any(x => x.Mobile == input.Mobile)) + if (!string.IsNullOrWhiteSpace(input.Mobile) && + _userPointManagementDbContext.Users.Any(x => x.Mobile == input.Mobile)) { throw new ArgumentException("手机号不可重复!"); } @@ -72,6 +73,7 @@ public class UserService : IUserService { throw new ArgumentException("名称不可重复!"); } + _userPointManagementDbContext.Users.Add(input); await _userPointManagementDbContext.SaveChangesAsync().ConfigureAwait(false); } diff --git a/src/UserPointManagement.Persistence/EntityTypeConfigurations/UserConfiguration.cs b/src/UserPointManagement.Persistence/EntityTypeConfigurations/UserConfiguration.cs index 473ad28..31329a3 100644 --- a/src/UserPointManagement.Persistence/EntityTypeConfigurations/UserConfiguration.cs +++ b/src/UserPointManagement.Persistence/EntityTypeConfigurations/UserConfiguration.cs @@ -9,10 +9,10 @@ public class UserConfiguration : IEntityTypeConfiguration public void Configure(EntityTypeBuilder builder) { builder.HasKey(e => e.Id); - + builder.Property(e => e.Id) .HasComment("主键"); - + builder.Property(e => e.Name) .HasComment("姓名") .HasMaxLength(50); diff --git a/src/UserPointManagement.Persistence/UserPointManagementDbContext.cs b/src/UserPointManagement.Persistence/UserPointManagementDbContext.cs index 7b7d34b..1ea298f 100644 --- a/src/UserPointManagement.Persistence/UserPointManagementDbContext.cs +++ b/src/UserPointManagement.Persistence/UserPointManagementDbContext.cs @@ -9,9 +9,9 @@ public class UserPointManagementDbContext : Microsoft.EntityFrameworkCore.DbCont public UserPointManagementDbContext(DbContextOptions options) : base(options) { } - + public virtual DbSet Users { get; set; } - + public virtual DbSet UserPoints { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder)