Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
23fce07b
Commit
23fce07b
authored
Jul 13, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restructure Api Layer.
parent
28a0eccc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
71 deletions
+97
-71
AuthenticationController.cs
...pi/Controllers/Authentication/AuthenticationController.cs
+55
-0
HomeController.cs
PSManagement.Api/Controllers/HomeController.cs
+22
-0
WeatherForecastController.cs
PSManagement.Api/Controllers/WeatherForecastController.cs
+0
-39
DependencyInjection.cs
PSManagement.Api/DI/DependencyInjection.cs
+0
-15
PSManagement.Api.csproj
PSManagement.Api/PSManagement.Api.csproj
+6
-0
Startup.cs
PSManagement.Api/Startup.cs
+7
-1
WeatherForecast.cs
PSManagement.Api/WeatherForecast.cs
+0
-15
appsettings.json
PSManagement.Api/appsettings.json
+7
-1
No files found.
PSManagement.Api/Controllers/Authentication/AuthenticationController.cs
0 → 100644
View file @
23fce07b
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
PSManagement.Application.Contracts.Authentication
;
using
PSManagement.Contracts.Authentication
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
PSManagement.Api.Controllers.Authentication
{
[
Route
(
"api/[controller]"
)]
[
ApiController
]
public
class
AuthenticationController
:
ControllerBase
{
private
readonly
IAuthenticationService
_authenticationService
;
public
AuthenticationController
(
IAuthenticationService
authenticationService
)
{
_authenticationService
=
authenticationService
;
}
[
HttpPost
(
"Login"
)]
public
async
Task
<
IActionResult
>
Login
([
FromBody
]
LoginRequest
loginRequest
)
{
AuthenticationResult
result
=
await
_authenticationService
.
Login
(
loginRequest
.
Email
,
loginRequest
.
PassWorrd
);
AuthenticationResponse
response
=
new
AuthenticationResponse
(
result
.
Id
,
result
.
FirstName
,
result
.
LastName
,
result
.
Email
,
result
.
Token
);
return
Ok
(
response
);
}
[
HttpPost
(
"Register"
)]
public
async
Task
<
IActionResult
>
Register
([
FromBody
]
RegisterRequest
registerRequest
)
{
AuthenticationResult
result
=
await
_authenticationService
.
Register
(
registerRequest
.
Email
,
registerRequest
.
FirstName
,
registerRequest
.
LastName
,
registerRequest
.
Password
);
AuthenticationResponse
response
=
new
AuthenticationResponse
(
result
.
Id
,
result
.
FirstName
,
result
.
LastName
,
result
.
Email
,
result
.
Token
);
return
Ok
(
response
);
}
}
}
PSManagement.Api/Controllers/HomeController.cs
0 → 100644
View file @
23fce07b
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
PSManagement.Api.Controllers
{
[
Route
(
"api/[controller]"
)]
[
ApiController
]
public
class
HomeController
:
ControllerBase
{
[
HttpGet
]
public
async
Task
<
IActionResult
>
Get
()
{
return
Ok
(
new
{
message
=
"success"
});
}
}
}
PSManagement.Api/Controllers/WeatherForecastController.cs
deleted
100644 → 0
View file @
28a0eccc
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
PSManagement.Api.Controllers
{
[
ApiController
]
[
Route
(
"[controller]"
)]
public
class
WeatherForecastController
:
ControllerBase
{
private
static
readonly
string
[]
Summaries
=
new
[]
{
"Freezing"
,
"Bracing"
,
"Chilly"
,
"Cool"
,
"Mild"
,
"Warm"
,
"Balmy"
,
"Hot"
,
"Sweltering"
,
"Scorching"
};
private
readonly
ILogger
<
WeatherForecastController
>
_logger
;
public
WeatherForecastController
(
ILogger
<
WeatherForecastController
>
logger
)
{
_logger
=
logger
;
}
[
HttpGet
]
public
IEnumerable
<
WeatherForecast
>
Get
()
{
var
rng
=
new
Random
();
return
Enumerable
.
Range
(
1
,
5
).
Select
(
index
=>
new
WeatherForecast
{
Date
=
DateTime
.
Now
.
AddDays
(
index
),
TemperatureC
=
rng
.
Next
(-
20
,
55
),
Summary
=
Summaries
[
rng
.
Next
(
Summaries
.
Length
)]
})
.
ToArray
();
}
}
}
PSManagement.Api/DI/DependencyInjection.cs
deleted
100644 → 0
View file @
28a0eccc
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
namespace
PSManagement.Api.DI
{
public
static
class
DependencyInjection
{
public
static
IServiceCollection
AddApi
(
this
IServiceCollection
services
)
{
return
services
;
}
}
}
PSManagement.Api/PSManagement.Api.csproj
View file @
23fce07b
...
...
@@ -8,4 +8,10 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PSManagement.Application\PSManagement.Application.csproj" />
<ProjectReference Include="..\PSManagement.Infrastructure\PSManagement.Infrastructure.csproj" />
<ProjectReference Include="..\PSManagement.Presentation\PSManagement.Presentation.csproj" />
</ItemGroup>
</Project>
PSManagement.Api/Startup.cs
View file @
23fce07b
...
...
@@ -5,7 +5,9 @@ using Microsoft.AspNetCore.Mvc;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
PSManagement.Presentaion.DI
;
using
PSManagement.Infrastructure.DI
;
using
PSManagement.Application.DI
;
using
Microsoft.OpenApi.Models
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -27,6 +29,10 @@ namespace PSManagement.Api
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddPresentation
();
services
.
AddApplication
();
services
.
AddInfrastructure
(
Configuration
);
services
.
AddControllers
();
services
.
AddSwaggerGen
(
c
=>
{
...
...
PSManagement.Api/WeatherForecast.cs
deleted
100644 → 0
View file @
28a0eccc
using
System
;
namespace
PSManagement.Api
{
public
class
WeatherForecast
{
public
DateTime
Date
{
get
;
set
;
}
public
int
TemperatureC
{
get
;
set
;
}
public
int
TemperatureF
=>
32
+
(
int
)(
TemperatureC
/
0.5556
);
public
string
Summary
{
get
;
set
;
}
}
}
PSManagement.Api/appsettings.json
View file @
23fce07b
...
...
@@ -6,5 +6,11 @@
"Microsoft.Hosting.Lifetime"
:
"Information"
}
},
"AllowedHosts"
:
"*"
"AllowedHosts"
:
"*"
,
"JwtSettings"
:
{
"secret"
:
"super-secret-key"
,
"ExpireMinutes"
:
60
,
"Issuer"
:
"HIAST-PS-Management"
,
"Audience"
:
""
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment