Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reports service #206

Merged
merged 37 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e94bde0
(#171) add project basic structure
eggwhat May 21, 2024
2b07da5
(#171) add package references
eggwhat May 21, 2024
fc9a884
(#171) add structure files
eggwhat May 22, 2024
7adf441
(#171) add project references
eggwhat May 22, 2024
d6b68b5
(#171) add entities
eggwhat May 22, 2024
c3a5da5
(#171) add repositories
eggwhat May 22, 2024
67f21c8
(#171) add new field for entities
eggwhat May 22, 2024
5db2371
(#171) add repository for reports
eggwhat May 22, 2024
d559e10
(#171) add external events
eggwhat May 22, 2024
4f9b7b6
(#171) add report validator
eggwhat May 23, 2024
42e49a7
(#171) add command with handler for creating a report
eggwhat May 23, 2024
138e05d
(#171) remove student related objects
eggwhat May 23, 2024
caf60ff
(#171) add command for cancelling report
eggwhat May 23, 2024
3985778
(#171) add command and handler for starting report review
eggwhat May 23, 2024
fd2fd7d
(#171) fix typo
eggwhat May 23, 2024
e90afc0
(#171) add command and handlers for resolving and rejecting reports
eggwhat May 24, 2024
e7ef2d5
(#171) update endpoint declaration
eggwhat May 24, 2024
0502aee
(#171) add pagination objects
eggwhat May 24, 2024
c335aba
(#171) add reports service
eggwhat May 24, 2024
9db847e
(#171) update report mongo repository
eggwhat May 24, 2024
c01a294
(#171) add search option through categories and states
eggwhat May 24, 2024
e46b39e
(#171) add query for student reports
eggwhat May 26, 2024
b3e3a65
(#171) fix issue with nullable field
eggwhat May 26, 2024
1124f4b
(#189) update port number
eggwhat May 26, 2024
2eddfae
(#31) update ntrada for reports service
eggwhat May 26, 2024
5ba14f4
(#189) update logging messages
eggwhat May 26, 2024
b563a77
(#31) update ntrada for reports service missing endpoint
eggwhat May 26, 2024
8b5b082
(#189) update context types
eggwhat May 27, 2024
6a2bd69
(#189) add student entities
eggwhat May 27, 2024
5de1170
(#171) add reports filter for admin assigned reports
eggwhat May 27, 2024
9d0de35
(#171) fix typo
eggwhat May 27, 2024
e07af71
(#171) add command and handler for deleting reports
eggwhat May 27, 2024
f2da158
(#31) update ntrada for new reports endpoint
eggwhat May 27, 2024
b418879
(#171) update logging messages
eggwhat May 27, 2024
cc795c2
(#57) add report web entities
eggwhat May 27, 2024
627edf2
(#171) update endpoint url
eggwhat May 27, 2024
7b80d96
(#57) add reports service
eggwhat May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,46 @@ modules:
downstream: reports-service/reports
auth: true

- upstream: /
method: GET
- upstream: /{reportId}
method: DELETE
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/{reportId}
auth: true

- upstream: /
method: PUT
- upstream: /search
method: POST
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/search
auth: true

- upstream: /{reportId}
- upstream: /{reportId}/cancel
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/cancel
auth: true

- upstream: /{reportId}/start-review
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/start-review
auth: true

- upstream: /{reportId}/resolve
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/resolve
auth: true

- upstream: /{reportId}/reject
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/reject
auth: true

- upstream: /students/{studentId}
method: GET
use: downstream
downstream: reports-service/reports/{reportId}
downstream: reports-service/reports/students/{studentId}
auth: true

services:
Expand Down
40 changes: 32 additions & 8 deletions MiniSpace.APIGateway/src/MiniSpace.APIGateway/ntrada-async.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,46 @@ modules:
downstream: reports-service/reports
auth: true

- upstream: /
method: GET
- upstream: /{reportId}
method: DELETE
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/{reportId}
auth: true

- upstream: /
method: PUT
- upstream: /search
method: POST
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/search
auth: true

- upstream: /{reportId}
- upstream: /{reportId}/cancel
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/cancel
auth: true

- upstream: /{reportId}/start-review
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/start-review
auth: true

- upstream: /{reportId}/resolve
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/resolve
auth: true

- upstream: /{reportId}/reject
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/reject
auth: true

- upstream: /students/{studentId}
method: GET
use: downstream
downstream: reports-service/reports/{reportId}
downstream: reports-service/reports/students/{studentId}
auth: true

services:
Expand Down
40 changes: 32 additions & 8 deletions MiniSpace.APIGateway/src/MiniSpace.APIGateway/ntrada.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,46 @@ modules:
downstream: reports-service/reports
auth: true

- upstream: /
method: GET
- upstream: /{reportId}
method: DELETE
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/{reportId}
auth: true

- upstream: /
method: PUT
- upstream: /search
method: POST
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/search
auth: true

- upstream: /{reportId}
- upstream: /{reportId}/cancel
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/cancel
auth: true

- upstream: /{reportId}/start-review
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/start-review
auth: true

- upstream: /{reportId}/resolve
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/resolve
auth: true

- upstream: /{reportId}/reject
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/reject
auth: true

- upstream: /students/{studentId}
method: GET
use: downstream
downstream: reports-service/reports/{reportId}
downstream: reports-service/reports/students/{studentId}
auth: true

services:
Expand Down
40 changes: 32 additions & 8 deletions MiniSpace.APIGateway/src/MiniSpace.APIGateway/ntrada.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,46 @@ modules:
downstream: reports-service/reports
auth: true

- upstream: /
method: GET
- upstream: /{reportId}
method: DELETE
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/{reportId}
auth: true

- upstream: /
method: PUT
- upstream: /search
method: POST
use: downstream
downstream: reports-service/reports
downstream: reports-service/reports/search
auth: true

- upstream: /{reportId}
- upstream: /{reportId}/cancel
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/cancel
auth: true

- upstream: /{reportId}/start-review
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/start-review
auth: true

- upstream: /{reportId}/resolve
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/resolve
auth: true

- upstream: /{reportId}/reject
method: POST
use: downstream
downstream: reports-service/reports/{reportId}/reject
auth: true

- upstream: /students/{studentId}
method: GET
use: downstream
downstream: reports-service/reports/{reportId}
downstream: reports-service/reports/students/{studentId}
auth: true

services:
Expand Down
48 changes: 48 additions & 0 deletions MiniSpace.Services.Reports/MiniSpace.Services.Reports.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{62C95F84-EA55-4778-B3B2-A86F4CAC3251}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Reports.Api", "src\MiniSpace.Services.Reports.Api\MiniSpace.Services.Reports.Api.csproj", "{1B494198-CB0A-49A0-95A8-4AAE613CEACA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Reports.Application", "src\MiniSpace.Services.Reports.Application\MiniSpace.Services.Reports.Application.csproj", "{E9BDACF7-D03A-4CAF-B127-80444BB751CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Reports.Core", "src\MiniSpace.Services.Reports.Core\MiniSpace.Services.Reports.Core.csproj", "{C1F71C74-5021-4FC8-9EB9-7222D093ABF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Reports.Infrastructure", "src\MiniSpace.Services.Reports.Infrastructure\MiniSpace.Services.Reports.Infrastructure.csproj", "{F4851582-777D-473D-8A50-AB4FA57EC91A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1B494198-CB0A-49A0-95A8-4AAE613CEACA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B494198-CB0A-49A0-95A8-4AAE613CEACA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B494198-CB0A-49A0-95A8-4AAE613CEACA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B494198-CB0A-49A0-95A8-4AAE613CEACA}.Release|Any CPU.Build.0 = Release|Any CPU
{E9BDACF7-D03A-4CAF-B127-80444BB751CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9BDACF7-D03A-4CAF-B127-80444BB751CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9BDACF7-D03A-4CAF-B127-80444BB751CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9BDACF7-D03A-4CAF-B127-80444BB751CD}.Release|Any CPU.Build.0 = Release|Any CPU
{C1F71C74-5021-4FC8-9EB9-7222D093ABF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1F71C74-5021-4FC8-9EB9-7222D093ABF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1F71C74-5021-4FC8-9EB9-7222D093ABF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1F71C74-5021-4FC8-9EB9-7222D093ABF9}.Release|Any CPU.Build.0 = Release|Any CPU
{F4851582-777D-473D-8A50-AB4FA57EC91A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4851582-777D-473D-8A50-AB4FA57EC91A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4851582-777D-473D-8A50-AB4FA57EC91A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4851582-777D-473D-8A50-AB4FA57EC91A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1B494198-CB0A-49A0-95A8-4AAE613CEACA} = {62C95F84-EA55-4778-B3B2-A86F4CAC3251}
{E9BDACF7-D03A-4CAF-B127-80444BB751CD} = {62C95F84-EA55-4778-B3B2-A86F4CAC3251}
{C1F71C74-5021-4FC8-9EB9-7222D093ABF9} = {62C95F84-EA55-4778-B3B2-A86F4CAC3251}
{F4851582-777D-473D-8A50-AB4FA57EC91A} = {62C95F84-EA55-4778-B3B2-A86F4CAC3251}
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions MiniSpace.Services.Reports/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
dotnet build -c release
11 changes: 11 additions & 0 deletions MiniSpace.Services.Reports/scripts/dockerize-tag-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

export ASPNETCORE_ENVIRONMENT=docker

cd ..

docker build -t minispace.services.reports:latest .

docker tag minispace.services.reports:latest adrianvsaint/minispace.services.reports:latest

docker push adrianvsaint/minispace.services.reports:latest
4 changes: 4 additions & 0 deletions MiniSpace.Services.Reports/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
export ASPNETCORE_ENVIRONMENT=local
cd ../src/MiniSpace.Services.Reports.Api
dotnet run
2 changes: 2 additions & 0 deletions MiniSpace.Services.Reports/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
dotnet test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>disable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Convey" Version="1.1.448" />
<PackageReference Include="Convey.Logging" Version="1.1.448" />
<PackageReference Include="Convey.WebApi" Version="1.1.448" />
<PackageReference Include="Convey.WebApi.CQRS" Version="1.1.448" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MiniSpace.Services.Reports.Application\MiniSpace.Services.Reports.Application.csproj" />
<ProjectReference Include="..\MiniSpace.Services.Reports.Core\MiniSpace.Services.Reports.Core.csproj" />
<ProjectReference Include="..\MiniSpace.Services.Reports.Infrastructure\MiniSpace.Services.Reports.Infrastructure.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Convey;
using Convey.Logging;
using Convey.Types;
using Convey.WebApi;
using Convey.WebApi.CQRS;
using Microsoft.AspNetCore;
using MiniSpace.Services.Reports.Application;
using MiniSpace.Services.Reports.Application.Commands;
using MiniSpace.Services.Reports.Application.DTO;
using MiniSpace.Services.Reports.Application.Queries;
using MiniSpace.Services.Reports.Application.Services;
using MiniSpace.Services.Reports.Core.Wrappers;
using MiniSpace.Services.Reports.Infrastructure;

namespace MiniSpace.Services.Reports.Api
{
public class Program
{
public static async Task Main(string[] args)
=> await WebHost.CreateDefaultBuilder(args)
.ConfigureServices(services => services
.AddConvey()
.AddWebApi()
.AddApplication()
.AddInfrastructure()
.Build())
.Configure(app => app
.UseInfrastructure()
.UseEndpoints(endpoints => endpoints
.Post<SearchReports>("reports/search", async (cmd, ctx) =>
{
var pagedResult = await ctx.RequestServices.GetService<IReportsService>().BrowseReportsAsync(cmd);
await ctx.Response.WriteJsonAsync(pagedResult);
})
)
.UseDispatcherEndpoints(endpoints => endpoints
.Get("", ctx => ctx.Response.WriteAsync(ctx.RequestServices.GetService<AppOptions>().Name))
.Post<CreateReport>("reports", afterDispatch: (cmd, ctx)
=> ctx.Response.Created($"reports/{cmd.ReportId}"))
.Delete<DeleteReport>("reports/{reportId}")
.Post<CancelReport>("reports/{reportId}/cancel")
.Post<StartReportReview>("reports/{reportId}/start-review")
.Post<ResolveReport>("reports/{reportId}/resolve")
.Post<RejectReport>("reports/{reportId}/reject")
.Get<GetStudentReports, PagedResponse<IEnumerable<ReportDto>>>("reports/students/{studentId}")
))
.UseLogging()
.Build()
.RunAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5005"
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
}
},
"MiniSpace.Services.Reports": {
"commandName": "Project",
"launchBrowser": false,
"applicationUrl": "http://localhost:5005",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
}
}
}
}
Loading
Loading