Skip to content

Commit 2d4c85e

Browse files
committed
init
0 parents  commit 2d4c85e

File tree

110 files changed

+17759
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+17759
-0
lines changed

.gitignore

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
App.db
2+
appsettings.json
3+
# Logs and databases #
4+
######################
5+
*.log
6+
*.sql
7+
*.sqlite
8+
## Ignore Visual Studio temporary files, build results, and
9+
## files generated by popular Visual Studio add-ons.
10+
11+
# User-specific files
12+
*.suo
13+
*.user
14+
*.userosscache
15+
*.sln.docstates
16+
17+
# User-specific files (MonoDevelop/Xamarin Studio)
18+
*.userprefs
19+
20+
# Build results
21+
[Dd]ebug/
22+
[Dd]ebugPublic/
23+
[Rr]elease/
24+
[Rr]eleases/
25+
x64/
26+
x86/
27+
build/
28+
bld/
29+
bin/
30+
Bin/
31+
obj/
32+
Obj/
33+
34+
# Visual Studio 2015 cache/options directory
35+
.vs/
36+
.vscode/
37+
# MSTest test Results
38+
[Tt]est[Rr]esult*/
39+
[Bb]uild[Ll]og.*
40+
41+
# NUNIT
42+
*.VisualState.xml
43+
TestResult.xml
44+
45+
# Build Results of an ATL Project
46+
[Dd]ebugPS/
47+
[Rr]eleasePS/
48+
dlldata.c
49+
50+
*_i.c
51+
*_p.c
52+
*_i.h
53+
*.ilk
54+
*.meta
55+
*.obj
56+
*.pch
57+
*.pdb
58+
*.pgc
59+
*.pgd
60+
*.rsp
61+
*.sbr
62+
*.tlb
63+
*.tli
64+
*.tlh
65+
*.tmp
66+
*.tmp_proj
67+
*.log
68+
*.vspscc
69+
*.vssscc
70+
.builds
71+
*.pidb
72+
*.svclog
73+
*.scc
74+
75+
# Chutzpah Test files
76+
_Chutzpah*
77+
78+
# Visual C++ cache files
79+
ipch/
80+
*.aps
81+
*.ncb
82+
*.opendb
83+
*.opensdf
84+
*.sdf
85+
*.cachefile
86+
87+
# Visual Studio profiler
88+
*.psess
89+
*.vsp
90+
*.vspx
91+
*.sap
92+
93+
# TFS 2012 Local Workspace
94+
$tf/
95+
96+
# Guidance Automation Toolkit
97+
*.gpState
98+
99+
# ReSharper is a .NET coding add-in
100+
_ReSharper*/
101+
*.[Rr]e[Ss]harper
102+
*.DotSettings.user
103+
104+
# JustCode is a .NET coding add-in
105+
.JustCode
106+
107+
# TeamCity is a build add-in
108+
_TeamCity*
109+
110+
# DotCover is a Code Coverage Tool
111+
*.dotCover
112+
113+
# NCrunch
114+
_NCrunch_*
115+
.*crunch*.local.xml
116+
nCrunchTemp_*
117+
118+
# MightyMoose
119+
*.mm.*
120+
AutoTest.Net/
121+
122+
# Web workbench (sass)
123+
.sass-cache/
124+
125+
# Installshield output folder
126+
[Ee]xpress/
127+
128+
# DocProject is a documentation generator add-in
129+
DocProject/buildhelp/
130+
DocProject/Help/*.HxT
131+
DocProject/Help/*.HxC
132+
DocProject/Help/*.hhc
133+
DocProject/Help/*.hhk
134+
DocProject/Help/*.hhp
135+
DocProject/Help/Html2
136+
DocProject/Help/html
137+
138+
# Click-Once directory
139+
publish/
140+
141+
# Publish Web Output
142+
*.[Pp]ublish.xml
143+
*.azurePubxml
144+
# TODO: Comment the next line if you want to checkin your web deploy settings
145+
# but database connection strings (with potential passwords) will be unencrypted
146+
*.pubxml
147+
*.publishproj
148+
149+
# NuGet Packages
150+
*.nupkg
151+
# The packages folder can be ignored because of Package Restore
152+
**/packages/*
153+
# except build/, which is used as an MSBuild target.
154+
!**/packages/build/
155+
# Uncomment if necessary however generally it will be regenerated when needed
156+
#!**/packages/repositories.config
157+
158+
# Microsoft Azure Build Output
159+
csx/
160+
*.build.csdef
161+
162+
# Microsoft Azure Emulator
163+
ecf/
164+
rcf/
165+
166+
# Microsoft Azure ApplicationInsights config file
167+
ApplicationInsights.config
168+
169+
# Windows Store app package directory
170+
AppPackages/
171+
BundleArtifacts/
172+
173+
# Visual Studio cache files
174+
# files ending in .cache can be ignored
175+
*.[Cc]ache
176+
# but keep track of directories ending in .cache
177+
!*.[Cc]ache/
178+
179+
# Others
180+
ClientBin/
181+
~$*
182+
*~
183+
*.dbmdl
184+
*.dbproj.schemaview
185+
*.pfx
186+
*.publishsettings
187+
orleans.codegen.cs
188+
189+
/node_modules
190+
191+
# RIA/Silverlight projects
192+
Generated_Code/
193+
194+
# Backup & report files from converting an old project file
195+
# to a newer Visual Studio version. Backup files are not needed,
196+
# because we have git ;-)
197+
_UpgradeReport_Files/
198+
Backup*/
199+
UpgradeLog*.XML
200+
UpgradeLog*.htm
201+
202+
# SQL Server files
203+
*.mdf
204+
*.ldf
205+
206+
# Business Intelligence projects
207+
*.rdl.data
208+
*.bim.layout
209+
*.bim_*.settings
210+
211+
# Microsoft Fakes
212+
FakesAssemblies/
213+
214+
# GhostDoc plugin setting file
215+
*.GhostDoc.xml
216+
217+
# Node.js Tools for Visual Studio
218+
.ntvs_analysis.dat
219+
220+
# Visual Studio 6 build log
221+
*.plg
222+
223+
# Visual Studio 6 workspace options file
224+
*.opt
225+
226+
# Visual Studio LightSwitch build output
227+
**/*.HTMLClient/GeneratedArtifacts
228+
**/*.DesktopClient/GeneratedArtifacts
229+
**/*.DesktopClient/ModelManifest.xml
230+
**/*.Server/GeneratedArtifacts
231+
**/*.Server/ModelManifest.xml
232+
_Pvt_Extensions
233+
234+
# Paket dependency manager
235+
.paket/paket.exe
236+
237+
# FAKE - F# Make
238+
.fake/

API/API.csproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" NoWarn="NU1605" />
9+
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0" NoWarn="NU1605" />
10+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
<PrivateAssets>all</PrivateAssets>
15+
</PackageReference>
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0" />
17+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
18+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
19+
</ItemGroup>
20+
21+
</Project>

API/API.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30709.132
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "API", "API.csproj", "{7924D39B-9E09-44EF-8403-F1BCB9938047}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{7924D39B-9E09-44EF-8403-F1BCB9938047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7924D39B-9E09-44EF-8403-F1BCB9938047}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7924D39B-9E09-44EF-8403-F1BCB9938047}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{7924D39B-9E09-44EF-8403-F1BCB9938047}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {CBD5C39B-CE86-4E4D-B72B-3835BA6812FC}
24+
EndGlobalSection
25+
EndGlobal

API/Controllers/AccountsController.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using API.Data.Entities;
2+
using API.Models;
3+
using API.Services;
4+
using Microsoft.AspNetCore.Identity;
5+
using Microsoft.AspNetCore.Mvc;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Threading.Tasks;
10+
11+
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
12+
13+
namespace API.Controllers
14+
{
15+
[Route("api/[controller]")]
16+
[ApiController]
17+
public class AccountsController : ControllerBase
18+
{
19+
private readonly UserManager<User> _userManager;
20+
private readonly SignInManager<User> _signInManager;
21+
private readonly IJWTTokenGenerator _jwtToken;
22+
23+
public AccountsController(UserManager<User> userManager, SignInManager<User> signInManager, IJWTTokenGenerator jwtToken)
24+
{
25+
_userManager = userManager;
26+
_signInManager = signInManager;
27+
_jwtToken = jwtToken;
28+
}
29+
30+
// POST api/account/login
31+
[HttpPost("login")]
32+
public async Task<IActionResult> Login(LoginModel model)
33+
{
34+
var userFromDb = await _userManager.FindByNameAsync(model.Username);
35+
if (userFromDb == null)
36+
{
37+
return BadRequest(new
38+
{
39+
message = "Unable to login",
40+
status = 400
41+
});
42+
}
43+
var result = await _signInManager.CheckPasswordSignInAsync(userFromDb, model.Password, false);
44+
45+
if (!result.Succeeded)
46+
{
47+
return BadRequest(new
48+
{
49+
message = "Unable to login",
50+
status = 400
51+
});
52+
}
53+
return Ok(new
54+
{
55+
token = _jwtToken.GenerateToken(userFromDb),
56+
status = 200
57+
});
58+
}
59+
}
60+
}

API/Controllers/PaymentsController.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using API.Models;
2+
using Microsoft.AspNetCore.Mvc;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
8+
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
9+
10+
namespace API.Controllers
11+
{
12+
[Route("api/[controller]")]
13+
[ApiController]
14+
public class PaymentsController : ControllerBase
15+
{
16+
// POST api/<PaymentsController> Create Session
17+
[HttpPost("create-checkout-session")]
18+
public IActionResult CreateCheckoutSession([FromBody] CreateCheckoutSessionRequest req)
19+
{
20+
//Snippet Goes here
21+
return Ok();
22+
}
23+
24+
[HttpPost("customer-portal")]
25+
public IActionResult CustomerPortal([FromBody] CustomerPortalRequest req)
26+
{
27+
//Snippet Goes here
28+
return Ok();
29+
}
30+
}
31+
32+
33+
}

0 commit comments

Comments
 (0)