Skip to content

Commit e9381e8

Browse files
committed
project might work.
1 parent 52708f4 commit e9381e8

File tree

24 files changed

+363
-168
lines changed

24 files changed

+363
-168
lines changed

services/project/host/Tasky.ProjectService.HttpApi.Host/ProjectServiceHttpApiHostModule.cs

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,31 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5-
using IdentityModel;
65
using Microsoft.AspNetCore.Authentication.JwtBearer;
76
using Microsoft.AspNetCore.Builder;
87
using Microsoft.AspNetCore.Cors;
98
using Microsoft.AspNetCore.DataProtection;
10-
using Microsoft.Extensions.Configuration;
119
using Microsoft.Extensions.DependencyInjection;
1210
using Microsoft.Extensions.Hosting;
1311
using Tasky.ProjectService.EntityFrameworkCore;
1412
using StackExchange.Redis;
1513
using Microsoft.OpenApi.Models;
1614
using Volo.Abp;
17-
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
18-
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
19-
using Volo.Abp.AspNetCore.Serilog;
20-
using Volo.Abp.AuditLogging.EntityFrameworkCore;
21-
using Volo.Abp.Autofac;
2215
using Volo.Abp.Caching;
23-
using Volo.Abp.Caching.StackExchangeRedis;
2416
using Volo.Abp.EntityFrameworkCore;
25-
using Volo.Abp.EntityFrameworkCore.SqlServer;
2617
using Volo.Abp.Localization;
2718
using Volo.Abp.Modularity;
2819
using Volo.Abp.MultiTenancy;
29-
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
30-
using Volo.Abp.Security.Claims;
31-
using Volo.Abp.SettingManagement.EntityFrameworkCore;
32-
using Volo.Abp.Swashbuckle;
33-
using Volo.Abp.TenantManagement.EntityFrameworkCore;
3420
using Volo.Abp.VirtualFileSystem;
21+
using Tasky.Shared.Hosting;
3522

3623
namespace Tasky.ProjectService;
3724

3825
[DependsOn(
26+
typeof(TaskyHostingModule),
3927
typeof(ProjectServiceApplicationModule),
4028
typeof(ProjectServiceEntityFrameworkCoreModule),
41-
typeof(ProjectServiceHttpApiModule),
42-
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
43-
typeof(AbpAutofacModule),
44-
typeof(AbpCachingStackExchangeRedisModule),
45-
typeof(AbpEntityFrameworkCoreSqlServerModule),
46-
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
47-
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
48-
typeof(AbpSettingManagementEntityFrameworkCoreModule),
49-
typeof(AbpTenantManagementEntityFrameworkCoreModule),
50-
typeof(AbpAspNetCoreSerilogModule),
51-
typeof(AbpSwashbuckleModule)
29+
typeof(ProjectServiceHttpApiModule)
5230
)]
5331
public class ProjectServiceHttpApiHostModule : AbpModule
5432
{
@@ -58,11 +36,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
5836
var hostingEnvironment = context.Services.GetHostingEnvironment();
5937
var configuration = context.Services.GetConfiguration();
6038

61-
Configure<AbpDbContextOptions>(options =>
62-
{
63-
options.UseSqlServer();
64-
});
65-
6639
Configure<AbpMultiTenancyOptions>(options =>
6740
{
6841
options.IsEnabled = true;

services/project/host/Tasky.ProjectService.HttpApi.Host/Tasky.ProjectService.HttpApi.Host.csproj

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<Import Project="..\..\common.props" />
44

@@ -10,24 +10,11 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
14-
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
15-
<PackageReference Include="IdentityModel" Version="5.1.0" />
16-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
17-
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.0" />
18-
<PackageReference Include="Volo.Abp.Autofac" Version="5.2.0" />
19-
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="5.2.0" />
20-
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="5.2.0" />
21-
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.2.0" />
22-
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="5.2.0" />
23-
<PackageReference Include="Volo.Abp.Swashbuckle" Version="5.2.0" />
24-
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="5.2.0" />
25-
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="5.2.0" />
26-
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="5.2.0" />
27-
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="5.2.0" />
13+
2814
</ItemGroup>
2915

3016
<ItemGroup>
17+
<ProjectReference Include="..\..\..\..\shared\Tasky.Shared.Hosting\Tasky.Shared.Hosting.csproj" />
3118
<ProjectReference Include="..\..\src\Tasky.ProjectService.HttpApi\Tasky.ProjectService.HttpApi.csproj" />
3219
<ProjectReference Include="..\..\src\Tasky.ProjectService.Application\Tasky.ProjectService.Application.csproj" />
3320
<ProjectReference Include="..\..\src\Tasky.ProjectService.EntityFrameworkCore\Tasky.ProjectService.EntityFrameworkCore.csproj" />

services/project/host/Tasky.ProjectService.HttpApi.Host/appsettings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
"CorsOrigins": "https://*.ProjectService.com,http://localhost:4200,http://localhost:44307,https://localhost:44307"
44
},
55
"ConnectionStrings": {
6-
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=ProjectService_Main;Trusted_Connection=True",
7-
"ProjectService": "Server=(LocalDb)\\MSSQLLocalDB;Database=ProjectService_Module;Trusted_Connection=True"
6+
"ProjectService": "User ID=postgres;Password=postgres;Host=localhost;Port=5432;Database=TaskyProjectService;Pooling=false;",
7+
"SaaSService": "User ID=postgres;Password=postgres;Host=localhost;Port=5432;Database=TaskySaaSService;Pooling=false;",
8+
"AdministrationService": "User ID=postgres;Password=postgres;Host=localhost;Port=5432;Database=TaskyAdministrationService;Pooling=false;"
89
},
910
"Redis": {
1011
"Configuration": "127.0.0.1"
1112
},
1213
"AuthServer": {
13-
"Authority": "https://localhost:44399/",
14+
"Authority": "https://localhost:7000/",
1415
"RequireHttpsMetadata": "false",
1516
"SwaggerClientId": "ProjectService_Swagger",
1617
"SwaggerClientSecret": "1q2w3e*"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
using Volo.Abp.Application.Services;
4+
5+
namespace Tasky.ProjectService;
6+
7+
public interface IProjectAppService : IApplicationService
8+
{
9+
Task<List<ProjectDto>> GetAllAsync();
10+
11+
Task<ProjectDto> Create(ProjectDto projectDto);
12+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Tasky.ProjectService;
2+
3+
public class ProjectDto
4+
{
5+
public string Name { get; set; }
6+
}

services/project/src/Tasky.ProjectService.Application.Contracts/Samples/ISampleAppService.cs

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

services/project/src/Tasky.ProjectService.Application.Contracts/Samples/SampleDto.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using Microsoft.AspNetCore.Authorization;
5+
using Volo.Abp.Domain.Repositories;
6+
7+
namespace Tasky.ProjectService;
8+
9+
public class ProjectAppService : ProjectServiceAppService, IProjectAppService
10+
{
11+
private readonly IRepository<Project, Guid> repository;
12+
13+
public ProjectAppService(IRepository<Project, Guid> repository)
14+
{
15+
this.repository = repository;
16+
}
17+
18+
[Authorize]
19+
public async Task<List<ProjectDto>> GetAllAsync()
20+
{
21+
var projects = await repository.GetListAsync();
22+
return ObjectMapper.Map<List<Project>,List<ProjectDto>>(projects);
23+
}
24+
25+
[Authorize]
26+
public async Task<ProjectDto> Create(ProjectDto projectDto)
27+
{
28+
var project = await repository.InsertAsync(new Project(projectDto.Name));
29+
return new ProjectDto
30+
{
31+
Name = project.Name
32+
};
33+
}
34+
}

services/project/src/Tasky.ProjectService.Application/Samples/SampleAppService.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using Volo.Abp.Domain.Entities;
3+
using Volo.Abp.MultiTenancy;
4+
5+
namespace Tasky.ProjectService
6+
{
7+
public class Project : AggregateRoot<Guid>, IMultiTenant
8+
{
9+
public string Name { get; set; }
10+
11+
public Guid? TenantId { get; set; }
12+
13+
public Project(string name)
14+
{
15+
Name = name;
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)