Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
[APP] Deprecating Azure (#86)
Browse files Browse the repository at this point in the history
* Update dependencies in package.json

* Deprecating Azure

* Update URLs in AdminNet and ShopNet

* Update URLs in appsettings.Production.json and AdminNet.ts

* Update appsettings.Production.json and network URLs

* Add React build and deploy to GitHub Pages

* Update AdminNet and ShopNet URLs and remove unnecessary code

* Update SSL configuration and URLs

* Update Kestrel endpoint protocols in appsettings.Production.json

* Refactor database connection handling in Program.cs
  • Loading branch information
Aloento authored Jan 3, 2024
1 parent deb08af commit a62a531
Show file tree
Hide file tree
Showing 23 changed files with 2,285 additions and 700 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/Azure.yml

This file was deleted.

33 changes: 25 additions & 8 deletions .github/workflows/Web.yml → .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Static Web Apps
name: AwaiShop

on:
push:
Expand All @@ -9,9 +9,16 @@ jobs:
build_deploy:
runs-on: ubuntu-latest
name: Build and Deploy

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: true

- name: Set up .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
dotnet-quality: preview

- uses: actions/setup-node@v3
with:
Expand All @@ -23,20 +30,20 @@ jobs:
version: "latest"
run_install: false

- name: Get pnpm store directory
shell: bash
- name: Get pnpm store
id: pnpm-cache
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Build
- name: Install React
run: pnpm install && pnpm build

- name: Pages Deploy
Expand All @@ -46,3 +53,13 @@ jobs:
publish_dir: ./dist
publish_branch: gh-pages
cname: Awai.Aloen.to

- name: Build C#
run: dotnet publish SoarCraft.AwaiShop/SoarCraft.AwaiShop.csproj -c Release -o AwaiShop -r linux-x64 --self-contained true

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./AwaiShop
publish_branch: Infra
11 changes: 11 additions & 0 deletions SSL.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
curl https://get.acme.sh | sh -s [email protected]
alias acme.sh=~/.acme.sh/acme.sh
acme.sh --issue -d awaishop.aloen.to --standalone

mkdir ./ASSL

acme.sh --install-cert -d awaishop.aloen.to \
--cert-file ./ASSL/chain.pem \
--key-file ./ASSL/privkey.pem \
--fullchain-file ./ASSL/fullchain.pem
4 changes: 2 additions & 2 deletions SoarCraft.AwaiShop/AdminHub/Order/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal partial class AdminHub {
* @version 0.1.1
* </remarks>
*/
public async Task<dynamic> OrderEntity(uint key, byte[]? version) {
public async Task<dynamic> OrderEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Orders
.AnyAsync(x => x.OrderId == key && x.Version == version);
Expand All @@ -37,7 +37,7 @@ public async Task<dynamic> OrderEntity(uint key, byte[]? version) {
* @version 0.1.0
* </remarks>
*/
public async Task<dynamic?> CommentEntity(uint key, byte[]? version) {
public async Task<dynamic?> CommentEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Comments
.AnyAsync(x => x.CommentId == key && x.Version == version);
Expand Down
2 changes: 1 addition & 1 deletion SoarCraft.AwaiShop/AdminHub/User/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal partial class AdminHub {
* @version 0.1.0
* </remarks>
*/
public async Task<dynamic?> UserEntity(Guid key, byte[]? version) {
public async Task<dynamic?> UserEntity(Guid key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Users
.AnyAsync(x => x.UserId == key && x.Version == version);
Expand Down
5 changes: 2 additions & 3 deletions SoarCraft.AwaiShop/Entities/Concurrency.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
namespace SoarCraft.AwaiShop.Entities;
namespace SoarCraft.AwaiShop.Entities;

using System.ComponentModel.DataAnnotations;

Expand All @@ -13,5 +12,5 @@ namespace SoarCraft.AwaiShop.Entities;
public abstract class Concurrency {
[Timestamp]
[ConcurrencyCheck]
public byte[] Version { get; set; }
public uint Version { get; set; }
}
2 changes: 1 addition & 1 deletion SoarCraft.AwaiShop/Helpers/DataSeeder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* </remarks>
*/
internal static class DataSeeder {
public static async Task SeedData(this IApplicationBuilder host) {
public static async Task SeedData(IApplicationBuilder host) {
await using var scope = host.ApplicationServices.CreateAsyncScope();
await using var context = scope.ServiceProvider.GetRequiredService<ShopContext>();

Expand Down
4 changes: 2 additions & 2 deletions SoarCraft.AwaiShop/Hub/Order/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal partial class ShopHub {
* </remarks>
*/
[Authorize]
public async Task<dynamic> OrderEntity(uint key, byte[]? version) {
public async Task<dynamic> OrderEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Orders
.AnyAsync(x => x.OrderId == key && x.Version == version);
Expand All @@ -39,7 +39,7 @@ public async Task<dynamic> OrderEntity(uint key, byte[]? version) {
* </remarks>
*/
[Authorize]
public async Task<dynamic?> CommentEntity(uint key, byte[]? version) {
public async Task<dynamic?> CommentEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Comments
.AnyAsync(x => x.CommentId == key && x.Version == version);
Expand Down
8 changes: 4 additions & 4 deletions SoarCraft.AwaiShop/Hub/Product/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal partial class ShopHub {
* @version 0.1.0
* </remarks>
*/
public async Task<dynamic?> ProductEntity(uint key, byte[]? version) {
public async Task<dynamic?> ProductEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Products
.AnyAsync(x => x.ProductId == key && x.Version == version);
Expand All @@ -36,7 +36,7 @@ internal partial class ShopHub {
* @version 0.1.0
* </remarks>
*/
public async Task<dynamic?> PhotoEntity(uint key, byte[]? version) {
public async Task<dynamic?> PhotoEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Photos
.AnyAsync(x => x.PhotoId == key && x.Version == version);
Expand All @@ -63,7 +63,7 @@ internal partial class ShopHub {
* @version 0.1.0
* </remarks>
*/
public async Task<dynamic?> TypeEntity(uint key, byte[]? version) {
public async Task<dynamic?> TypeEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Types
.AnyAsync(x => x.TypeId == key && x.Version == version);
Expand All @@ -88,7 +88,7 @@ internal partial class ShopHub {
* @version 0.1.0
* </remarks>
*/
public async Task<dynamic?> VariantEntity(uint key, byte[]? version) {
public async Task<dynamic?> VariantEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Variants
.AnyAsync(x => x.VariantId == key && x.Version == version);
Expand Down
2 changes: 1 addition & 1 deletion SoarCraft.AwaiShop/Hub/User/Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal partial class ShopHub {
* </remarks>
*/
[Authorize]
public async Task<dynamic?> UserGetMe(byte _, byte[]? version) {
public async Task<dynamic?> UserGetMe(byte _, uint? version) {
var hasNew = this.Context.Items.TryGetValue("NewUser", out var isNew);
if (hasNew && isNew is true) return null;

Expand Down
Loading

0 comments on commit a62a531

Please sign in to comment.