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

Update project dependencies, configs, and UI components #47

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/MLS.Api/MLS.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.36.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="System.Formats.Asn1" Version="6.0.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
</ItemGroup>

Expand Down
36 changes: 5 additions & 31 deletions src/MLS.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo() { Title = "MatLidStore ASP .NET Core 6 API", Version = "v1" });
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme()
c.SwaggerDoc("v1", new OpenApiInfo { Title = "MatLidStore ASP .NET Core 6 API", Version = "v1" });
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Hãy nhập token người dùng sử dụng lược đồ Bearer. Ví dụ: \"Authorization: Bearer {token}\"",
Expand All @@ -29,12 +29,12 @@
BearerFormat = "JWT",
Scheme = "Bearer"
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement()
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme()
new OpenApiSecurityScheme
{
Reference = new OpenApiReference()
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
Expand All @@ -45,32 +45,6 @@
});
});

//var key = Encoding.ASCII.GetBytes(builder.Configuration["Jwt:Key"]);
//builder.Services.AddAuthentication(options =>
//{
// options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
// options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
//}).AddJwtBearer(options =>
//{
// options.RequireHttpsMetadata = false;
// options.SaveToken = true;
// options.TokenValidationParameters = new TokenValidationParameters
// {
// ValidateIssuer = true,
// ValidateAudience = true,
// ValidateLifetime = true,
// ValidateIssuerSigningKey = true,
// ValidIssuer = builder.Configuration["Jwt:Issuer"],
// ValidAudience = builder.Configuration["Jwt:Audience"],
// IssuerSigningKey = new SymmetricSecurityKey(key)
// };
//});
//builder.Services.AddAuthorization(options =>
//{
// options.AddPolicy("AdminPolicy", policy => policy.RequireRole("Admin"));
// options.AddPolicy("UserPolicy", policy => policy.RequireRole("AppUser"));
//});

var app = builder.Build();

// Configure the HTTP request pipeline.
Expand Down
3 changes: 1 addition & 2 deletions src/MLS.Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7173;http://localhost:5049",
"applicationUrl": "https://localhost:8100;http://localhost:8000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -36,7 +36,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

},
"IIS Express": {
"commandName": "IISExpress",
Expand Down
12 changes: 12 additions & 0 deletions src/MLS.Api/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"MatLidConnectionString": "Data Source=localhost:1521/mlsdb;User Id=system;Password=Matliddev2024@"
}
}
4 changes: 2 additions & 2 deletions src/MLS.Domain/Entities/OrderDetail.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using MLS.Domain.Common;
using MLS.Domain.Common;
using System.ComponentModel.DataAnnotations.Schema;

namespace MLS.Domain.Entities;

Expand Down
4 changes: 2 additions & 2 deletions src/MLS.Domain/Entities/ShoppingCartItem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using MLS.Domain.Common;
using MLS.Domain.Common;
using System.ComponentModel.DataAnnotations.Schema;

namespace MLS.Domain.Entities;

Expand Down
4 changes: 2 additions & 2 deletions src/MLS.Domain/Entities/Supply.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using MLS.Domain.Common;
using MLS.Domain.Common;
using System.ComponentModel.DataAnnotations.Schema;

namespace MLS.Domain.Entities;

Expand Down
2 changes: 1 addition & 1 deletion src/MLS.Persistence/Configurations/EntityConfigurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void Configure(ModelBuilder modelBuilder, string tablePrefix)
modelBuilder.Entity<WishList>(b => { b.ToTable($"{tablePrefix}WishLists"); });
modelBuilder.Entity<WishListItem>(b => { b.ToTable($"{tablePrefix}WishListItems"); });

#endregion Configure to table name
#endregion Customize table name

#region Ensure relationships and delete cascading rules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public MatLidStoreDatabaseContext(DbContextOptions<MatLidStoreDatabaseContext> o
public DbSet<WishList> WishLists { get; set; } = null!;
public DbSet<WishListItem> WishListItems { get; set; } = null!;

#endregion Configure table in DB
#endregion Defines a set of entities in the database

public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new())
{
Expand Down
2 changes: 1 addition & 1 deletion src/MLS.Persistence/IdentityServiceRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class IdentityServiceRegistration
{
public static IServiceCollection AddIdentityServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<MatLidStoreDatabaseContext>(options => options.UseOracle(configuration.GetConnectionString("MatLidConnectionString")));
services.AddDbContext<MatLidStoreDatabaseContext>(options => { options.UseOracle(configuration.GetConnectionString("MatLidConnectionString")); });

services.AddIdentity<AppUser, AppRole>()
.AddEntityFrameworkStores<MatLidStoreDatabaseContext>()
Expand Down
1 change: 1 addition & 0 deletions src/MLS.Persistence/MLS.Persistence.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.150" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.32" />
<PackageReference Include="System.Formats.Asn1" Version="6.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

Expand Down Expand Up @@ -910,4 +909,4 @@ protected override void Down(MigrationBuilder migrationBuilder)
name: "MATLID_Users");
}
}
}
}
2 changes: 1 addition & 1 deletion src/MLS.WebUI/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"configurations": [
{
"name": "ng serve",
"type": "pwa-chrome",
"type": "pwa-edge",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
Expand Down
8 changes: 1 addition & 7 deletions src/MLS.WebUI/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
],
plugins: [require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage'), require('@angular-devkit/build-angular/plugins/karma')],
client: {
jasmine: {
// you can add configuration options for Jasmine here
Expand Down
Loading
Loading