Spaces:
Sleeping
Sleeping
Yuyuqt commited on
Commit ·
4433399
1
Parent(s): 1e653a4
add: blazor web assembly.
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Backend/Backend.csproj +1 -0
- Backend/Features/Auth/AuthController.cs +1 -0
- Backend/Features/Auth/AuthModels.cs +0 -26
- Backend/Features/Auth/AuthService.cs +1 -0
- Backend/Features/Books/BookController.cs +2 -0
- Backend/Features/Books/BookService.cs +1 -46
- Backend/Features/Borrowing/BorrowingController.cs +2 -0
- Backend/Features/Borrowing/BorrowingModels.cs +0 -24
- Backend/Features/Borrowing/BorrowingService.cs +2 -0
- Backend/Features/Categories/CategoryController.cs +2 -0
- Backend/Features/Categories/CategoryService.cs +1 -11
- Backend/Features/Loyalty/LoyaltyController.cs +2 -0
- Backend/Features/Loyalty/LoyaltyModels.cs +0 -38
- Backend/Features/Loyalty/LoyaltyService.cs +2 -0
- Backend/Features/Notification/INotificationService.cs +2 -0
- Backend/Features/Notification/NotificationBackgroundService.cs +2 -0
- Backend/Features/Notification/NotificationModels.cs +0 -36
- Backend/Features/Notification/NotificationService.cs +2 -0
- Backend/Features/Notification/NotificationsController.cs +2 -0
- Backend/Features/Subscriptions/SubscriptionController.cs +2 -0
- Backend/Features/Subscriptions/SubscriptionModels.cs +0 -41
- Backend/Features/Subscriptions/SubscriptionService.cs +2 -0
- Backend/Features/Users/UserController.cs +2 -0
- Backend/Features/Users/UserService.cs +1 -40
- Backend/Features/Wishlist/WishlistController.cs +2 -0
- Backend/Program.cs +4 -4
- BlazorFrontend/BlazorFrontend.csproj +4 -0
- BlazorFrontend/Components/Pages/Books.razor +2 -1
- BlazorFrontend/Components/Pages/Borrowings.razor +2 -1
- BlazorFrontend/Components/Pages/BorrowingsManage.razor +2 -1
- BlazorFrontend/Components/Pages/Home.razor +2 -1
- BlazorFrontend/Components/Pages/Login.razor +2 -1
- BlazorFrontend/Components/Pages/Members.razor +2 -1
- BlazorFrontend/Components/Pages/Membership.razor +2 -1
- BlazorFrontend/Components/Pages/Notifications.razor +2 -1
- BlazorFrontend/Components/Pages/Register.razor +2 -1
- BlazorFrontend/Components/Pages/Rewards.razor +2 -1
- BlazorFrontend/Components/Pages/RewardsManage.razor +2 -1
- BlazorFrontend/Components/Pages/UserInsights.razor +2 -1
- BlazorFrontend/Components/Pages/Wishlist.razor +2 -1
- BlazorFrontend/Components/_Imports.razor +1 -0
- BlazorFrontend/Models/Dtos/LoyaltyRedemptionDto.cs +0 -32
- BlazorFrontend/Models/MemberDetailsViewModel.cs +2 -1
- BlazorFrontend/Models/MembershipViewModel.cs +2 -1
- BlazorFrontend/Models/RewardsViewModel.cs +2 -1
- BlazorFrontend/Models/SubscriptionsViewModel.cs +2 -1
- BlazorFrontend/Services/LibraryApiClient.cs +1 -1
- BlazorFrontend/Services/WishlistService.cs +1 -1
- BlazorWebAssembly/App.razor +12 -0
- BlazorWebAssembly/BlazorWebAssembly.csproj +18 -0
Backend/Backend.csproj
CHANGED
|
@@ -20,6 +20,7 @@
|
|
| 20 |
|
| 21 |
<ItemGroup>
|
| 22 |
<ProjectReference Include="..\DbConnect\DbConnect.csproj" />
|
|
|
|
| 23 |
</ItemGroup>
|
| 24 |
|
| 25 |
</Project>
|
|
|
|
| 20 |
|
| 21 |
<ItemGroup>
|
| 22 |
<ProjectReference Include="..\DbConnect\DbConnect.csproj" />
|
| 23 |
+
<ProjectReference Include="..\LibraryManagement.Shared\LibraryManagement.Shared.csproj" />
|
| 24 |
</ItemGroup>
|
| 25 |
|
| 26 |
</Project>
|
Backend/Features/Auth/AuthController.cs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
using System.Security.Claims;
|
|
|
|
| 4 |
|
| 5 |
namespace Backend.Features.Auth
|
| 6 |
{
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
using System.Security.Claims;
|
| 4 |
+
using LibraryManagement.Shared.Models;
|
| 5 |
|
| 6 |
namespace Backend.Features.Auth
|
| 7 |
{
|
Backend/Features/Auth/AuthModels.cs
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
namespace Backend.Features.Auth
|
| 2 |
-
{
|
| 3 |
-
public class RegisterRequest
|
| 4 |
-
{
|
| 5 |
-
public string FullName { get; set; } = string.Empty;
|
| 6 |
-
public string Email { get; set; } = string.Empty;
|
| 7 |
-
public string Password { get; set; } = string.Empty;
|
| 8 |
-
public string? PhoneNumber { get; set; }
|
| 9 |
-
public string? Address { get; set; }
|
| 10 |
-
public string? StudentId { get; set; }
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
public class LoginRequest
|
| 14 |
-
{
|
| 15 |
-
public string Email { get; set; } = string.Empty;
|
| 16 |
-
public string Password { get; set; } = string.Empty;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
public class AuthResponse
|
| 20 |
-
{
|
| 21 |
-
public string Token { get; set; } = string.Empty;
|
| 22 |
-
public string FullName { get; set; } = string.Empty;
|
| 23 |
-
public string Role { get; set; } = string.Empty;
|
| 24 |
-
public DateTime Expiry { get; set; }
|
| 25 |
-
}
|
| 26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Backend/Features/Auth/AuthService.cs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
|
|
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
| 4 |
using Microsoft.IdentityModel.Tokens;
|
| 5 |
using System.IdentityModel.Tokens.Jwt;
|
|
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
+
using LibraryManagement.Shared.Models;
|
| 4 |
using Microsoft.EntityFrameworkCore;
|
| 5 |
using Microsoft.IdentityModel.Tokens;
|
| 6 |
using System.IdentityModel.Tokens.Jwt;
|
Backend/Features/Books/BookController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
|
|
@@ -75,3 +76,4 @@ namespace Backend.Features.Books
|
|
| 75 |
}
|
| 76 |
}
|
| 77 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Mvc;
|
| 4 |
|
|
|
|
| 76 |
}
|
| 77 |
}
|
| 78 |
}
|
| 79 |
+
|
Backend/Features/Books/BookService.cs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
| 4 |
-
using
|
| 5 |
|
| 6 |
namespace Backend.Features.Books
|
| 7 |
{
|
|
@@ -163,49 +163,4 @@ namespace Backend.Features.Books
|
|
| 163 |
};
|
| 164 |
}
|
| 165 |
}
|
| 166 |
-
|
| 167 |
-
public class BookDto
|
| 168 |
-
{
|
| 169 |
-
public int Id { get; set; }
|
| 170 |
-
public string Title { get; set; } = string.Empty;
|
| 171 |
-
public string Isbn { get; set; } = string.Empty;
|
| 172 |
-
public string Author { get; set; } = string.Empty;
|
| 173 |
-
public string Status { get; set; } = string.Empty;
|
| 174 |
-
public bool IsActive { get; set; }
|
| 175 |
-
public string? Description { get; set; }
|
| 176 |
-
public int TotalCopies { get; set; }
|
| 177 |
-
public int AvailableCopies { get; set; }
|
| 178 |
-
public DateTime CreatedAt { get; set; }
|
| 179 |
-
public DateTime? UpdatedAt { get; set; }
|
| 180 |
-
[JsonPropertyName("coverUrl")]
|
| 181 |
-
public string? CoverUrl { get; set; }
|
| 182 |
-
public List<BookCategoryDto> Categories { get; set; } = new();
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
public class BookCategoryDto
|
| 186 |
-
{
|
| 187 |
-
public int Id { get; set; }
|
| 188 |
-
public string Name { get; set; } = string.Empty;
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
public class BookCreateRequest
|
| 192 |
-
{
|
| 193 |
-
public string Title { get; set; } = string.Empty;
|
| 194 |
-
public string Isbn { get; set; } = string.Empty;
|
| 195 |
-
public string Author { get; set; } = string.Empty;
|
| 196 |
-
public string? Description { get; set; }
|
| 197 |
-
public int TotalCopies { get; set; }
|
| 198 |
-
public string? CoverUrl { get; set; }
|
| 199 |
-
public List<int>? CategoryIds { get; set; }
|
| 200 |
-
}
|
| 201 |
-
|
| 202 |
-
public class BookUpdateRequest
|
| 203 |
-
{
|
| 204 |
-
public string Title { get; set; } = string.Empty;
|
| 205 |
-
public string Author { get; set; } = string.Empty;
|
| 206 |
-
public string? Description { get; set; }
|
| 207 |
-
public int TotalCopies { get; set; }
|
| 208 |
-
public string? CoverUrl { get; set; }
|
| 209 |
-
public List<int>? CategoryIds { get; set; }
|
| 210 |
-
}
|
| 211 |
}
|
|
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
| 4 |
+
using LibraryManagement.Shared.Models;
|
| 5 |
|
| 6 |
namespace Backend.Features.Books
|
| 7 |
{
|
|
|
|
| 163 |
};
|
| 164 |
}
|
| 165 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
}
|
Backend/Features/Borrowing/BorrowingController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
using System.Security.Claims;
|
|
@@ -85,3 +86,4 @@ namespace Backend.Features.Borrowings
|
|
| 85 |
}
|
| 86 |
}
|
| 87 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Mvc;
|
| 4 |
using System.Security.Claims;
|
|
|
|
| 86 |
}
|
| 87 |
}
|
| 88 |
}
|
| 89 |
+
|
Backend/Features/Borrowing/BorrowingModels.cs
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
using System;
|
| 2 |
-
|
| 3 |
-
namespace Backend.Features.Borrowings
|
| 4 |
-
{
|
| 5 |
-
public class BorrowingDto
|
| 6 |
-
{
|
| 7 |
-
public Guid Id { get; set; }
|
| 8 |
-
public Guid UserId { get; set; }
|
| 9 |
-
public string UserEmail { get; set; } = string.Empty;
|
| 10 |
-
public int BookId { get; set; }
|
| 11 |
-
public string BookTitle { get; set; } = string.Empty;
|
| 12 |
-
public DateTime BorrowDate { get; set; }
|
| 13 |
-
public DateTime DueDate { get; set; }
|
| 14 |
-
public DateTime? ReturnDate { get; set; }
|
| 15 |
-
public string Status { get; set; } = string.Empty;
|
| 16 |
-
public decimal FineAmount { get; set; }
|
| 17 |
-
public bool IsFinePaid { get; set; }
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
public class BorrowRequest
|
| 21 |
-
{
|
| 22 |
-
public int BookId { get; set; }
|
| 23 |
-
}
|
| 24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Backend/Features/Borrowing/BorrowingService.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
|
@@ -231,3 +232,4 @@ namespace Backend.Features.Borrowings
|
|
| 231 |
}
|
| 232 |
}
|
| 233 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using DbConnect.Data;
|
| 3 |
using DbConnect.Entities;
|
| 4 |
using Microsoft.EntityFrameworkCore;
|
|
|
|
| 232 |
}
|
| 233 |
}
|
| 234 |
}
|
| 235 |
+
|
Backend/Features/Categories/CategoryController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
|
|
@@ -54,3 +55,4 @@ namespace Backend.Features.Categories
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Mvc;
|
| 4 |
|
|
|
|
| 55 |
}
|
| 56 |
}
|
| 57 |
}
|
| 58 |
+
|
Backend/Features/Categories/CategoryService.cs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
|
|
|
| 4 |
|
| 5 |
namespace Backend.Features.Categories
|
| 6 |
{
|
|
@@ -66,15 +67,4 @@ namespace Backend.Features.Categories
|
|
| 66 |
return true;
|
| 67 |
}
|
| 68 |
}
|
| 69 |
-
|
| 70 |
-
public class CategoryDto
|
| 71 |
-
{
|
| 72 |
-
public int Id { get; set; }
|
| 73 |
-
public string Name { get; set; } = string.Empty;
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
public class CategoryCreateRequest
|
| 77 |
-
{
|
| 78 |
-
public string Name { get; set; } = string.Empty;
|
| 79 |
-
}
|
| 80 |
}
|
|
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
| 4 |
+
using LibraryManagement.Shared.Models;
|
| 5 |
|
| 6 |
namespace Backend.Features.Categories
|
| 7 |
{
|
|
|
|
| 67 |
return true;
|
| 68 |
}
|
| 69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
Backend/Features/Loyalty/LoyaltyController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Backend.Features.Subscriptions;
|
| 2 |
using DbConnect.Data;
|
| 3 |
using Microsoft.AspNetCore.Authorization;
|
|
@@ -165,3 +166,4 @@ namespace Backend.Features.Loyalty
|
|
| 165 |
}
|
| 166 |
|
| 167 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Backend.Features.Subscriptions;
|
| 3 |
using DbConnect.Data;
|
| 4 |
using Microsoft.AspNetCore.Authorization;
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
}
|
| 169 |
+
|
Backend/Features/Loyalty/LoyaltyModels.cs
DELETED
|
@@ -1,38 +0,0 @@
|
|
| 1 |
-
using System;
|
| 2 |
-
using System.Text.Json.Serialization;
|
| 3 |
-
|
| 4 |
-
namespace Backend.Features.Loyalty
|
| 5 |
-
{
|
| 6 |
-
public class LoyaltyRedemptionDto
|
| 7 |
-
{
|
| 8 |
-
[JsonPropertyName("id")]
|
| 9 |
-
public string Id { get; set; } = string.Empty;
|
| 10 |
-
|
| 11 |
-
[JsonPropertyName("systemId")]
|
| 12 |
-
public string SystemId { get; set; } = string.Empty;
|
| 13 |
-
|
| 14 |
-
[JsonPropertyName("externalUserId")]
|
| 15 |
-
public string ExternalUserId { get; set; } = string.Empty;
|
| 16 |
-
|
| 17 |
-
[JsonPropertyName("rewardId")]
|
| 18 |
-
public string RewardId { get; set; } = string.Empty;
|
| 19 |
-
|
| 20 |
-
[JsonPropertyName("rewardName")]
|
| 21 |
-
public string RewardName { get; set; } = string.Empty;
|
| 22 |
-
|
| 23 |
-
[JsonPropertyName("pointCost")]
|
| 24 |
-
public double PointCost { get; set; }
|
| 25 |
-
|
| 26 |
-
[JsonPropertyName("status")]
|
| 27 |
-
public string Status { get; set; } = string.Empty;
|
| 28 |
-
|
| 29 |
-
[JsonPropertyName("redeemedAt")]
|
| 30 |
-
public DateTime RedeemedAt { get; set; }
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
public class ClaimRewardRequestDto
|
| 34 |
-
{
|
| 35 |
-
public string RewardId { get; set; } = string.Empty;
|
| 36 |
-
public string? Notes { get; set; }
|
| 37 |
-
}
|
| 38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Backend/Features/Loyalty/LoyaltyService.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using System;
|
| 2 |
using System.Collections.Generic;
|
| 3 |
using System.Net.Http;
|
|
@@ -330,3 +331,4 @@ namespace Backend.Features.Loyalty
|
|
| 330 |
public double LifetimePoints { get; set; }
|
| 331 |
}
|
| 332 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using System;
|
| 3 |
using System.Collections.Generic;
|
| 4 |
using System.Net.Http;
|
|
|
|
| 331 |
public double LifetimePoints { get; set; }
|
| 332 |
}
|
| 333 |
}
|
| 334 |
+
|
Backend/Features/Notification/INotificationService.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using System.Threading.Tasks;
|
| 2 |
using System.Collections.Generic;
|
| 3 |
|
|
@@ -11,3 +12,4 @@ public interface INotificationService
|
|
| 11 |
Task<bool> MarkAllAsReadAsync(Guid userId);
|
| 12 |
Task<int> GetUnreadCountAsync(Guid userId);
|
| 13 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using System.Threading.Tasks;
|
| 3 |
using System.Collections.Generic;
|
| 4 |
|
|
|
|
| 12 |
Task<bool> MarkAllAsReadAsync(Guid userId);
|
| 13 |
Task<int> GetUnreadCountAsync(Guid userId);
|
| 14 |
}
|
| 15 |
+
|
Backend/Features/Notification/NotificationBackgroundService.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.Extensions.DependencyInjection;
|
| 2 |
using Microsoft.Extensions.Hosting;
|
| 3 |
using System;
|
|
@@ -111,3 +112,4 @@ public class NotificationBackgroundService : BackgroundService
|
|
| 111 |
}
|
| 112 |
}
|
| 113 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.Extensions.DependencyInjection;
|
| 3 |
using Microsoft.Extensions.Hosting;
|
| 4 |
using System;
|
|
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
}
|
| 115 |
+
|
Backend/Features/Notification/NotificationModels.cs
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
namespace Backend.Features.Notification;
|
| 2 |
-
|
| 3 |
-
public class SubscriptionExpiryNotificationRequest
|
| 4 |
-
{
|
| 5 |
-
public Guid UserId { get; set; }
|
| 6 |
-
public string FcmToken { get; set; } = null!;
|
| 7 |
-
public string FullName { get; set; } = null!;
|
| 8 |
-
public int DaysRemaining { get; set; }
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
public class ReturnReminderNotificationRequest
|
| 12 |
-
{
|
| 13 |
-
public Guid UserId { get; set; }
|
| 14 |
-
public string FcmToken { get; set; } = null!;
|
| 15 |
-
public string FullName { get; set; } = null!;
|
| 16 |
-
public string BookTitle { get; set; } = null!;
|
| 17 |
-
public DateTime DueDate { get; set; }
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
public class NotificationDto
|
| 21 |
-
{
|
| 22 |
-
public int Id { get; set; }
|
| 23 |
-
public string Title { get; set; } = null!;
|
| 24 |
-
public string Message { get; set; } = null!;
|
| 25 |
-
public string Type { get; set; } = null!;
|
| 26 |
-
public string? ActionLink { get; set; }
|
| 27 |
-
public string? ActionText { get; set; }
|
| 28 |
-
public bool IsRead { get; set; }
|
| 29 |
-
public DateTime CreatedAt { get; set; }
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
public class NotificationResponse
|
| 33 |
-
{
|
| 34 |
-
public bool Success { get; set; }
|
| 35 |
-
public string Message { get; set; } = null!;
|
| 36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Backend/Features/Notification/NotificationService.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using FirebaseAdmin.Messaging;
|
| 2 |
using System;
|
| 3 |
using System.Collections.Generic;
|
|
@@ -128,3 +129,4 @@ public class NotificationService : INotificationService
|
|
| 128 |
.CountAsync(n => n.UserId == userId && !n.IsRead);
|
| 129 |
}
|
| 130 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using FirebaseAdmin.Messaging;
|
| 3 |
using System;
|
| 4 |
using System.Collections.Generic;
|
|
|
|
| 129 |
.CountAsync(n => n.UserId == userId && !n.IsRead);
|
| 130 |
}
|
| 131 |
}
|
| 132 |
+
|
Backend/Features/Notification/NotificationsController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Mvc;
|
| 2 |
using System;
|
| 3 |
using System.Collections.Generic;
|
|
@@ -99,3 +100,4 @@ public class NotificationsController : ControllerBase
|
|
| 99 |
return BadRequest(new NotificationResponse { Success = false, Message = "Failed to process notification" });
|
| 100 |
}
|
| 101 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
using System;
|
| 4 |
using System.Collections.Generic;
|
|
|
|
| 100 |
return BadRequest(new NotificationResponse { Success = false, Message = "Failed to process notification" });
|
| 101 |
}
|
| 102 |
}
|
| 103 |
+
|
Backend/Features/Subscriptions/SubscriptionController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
using System.Security.Claims;
|
|
@@ -101,3 +102,4 @@ namespace Backend.Features.Subscriptions
|
|
| 101 |
}
|
| 102 |
}
|
| 103 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Mvc;
|
| 4 |
using System.Security.Claims;
|
|
|
|
| 102 |
}
|
| 103 |
}
|
| 104 |
}
|
| 105 |
+
|
Backend/Features/Subscriptions/SubscriptionModels.cs
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
using System;
|
| 2 |
-
|
| 3 |
-
namespace Backend.Features.Subscriptions
|
| 4 |
-
{
|
| 5 |
-
public class MembershipDto
|
| 6 |
-
{
|
| 7 |
-
public int Id { get; set; }
|
| 8 |
-
public string Type { get; set; } = string.Empty;
|
| 9 |
-
public int MaxBooks { get; set; }
|
| 10 |
-
public int BorrowingDays { get; set; }
|
| 11 |
-
public decimal Price { get; set; }
|
| 12 |
-
public string Currency { get; set; } = "MMK";
|
| 13 |
-
public int DurationMonths { get; set; }
|
| 14 |
-
public string? RewardId { get; set; }
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
public class SubscriptionDto
|
| 18 |
-
{
|
| 19 |
-
public Guid Id { get; set; }
|
| 20 |
-
public Guid UserId { get; set; }
|
| 21 |
-
public int MembershipId { get; set; }
|
| 22 |
-
public string MembershipType { get; set; } = string.Empty;
|
| 23 |
-
public string UserEmail { get; set; } = string.Empty;
|
| 24 |
-
public string UserName { get; set; } = string.Empty;
|
| 25 |
-
public DateTime StartDate { get; set; }
|
| 26 |
-
public DateTime ExpiryDate { get; set; }
|
| 27 |
-
public bool IsActive { get; set; }
|
| 28 |
-
public bool IsExpired => DateTime.UtcNow > ExpiryDate;
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
public class SubscribeRequest
|
| 32 |
-
{
|
| 33 |
-
public int MembershipId { get; set; }
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
public class AdminSubscribeRequest
|
| 37 |
-
{
|
| 38 |
-
public Guid UserId { get; set; }
|
| 39 |
-
public int MembershipId { get; set; }
|
| 40 |
-
}
|
| 41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Backend/Features/Subscriptions/SubscriptionService.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using DbConnect.Data;
|
| 2 |
using DbConnect.Entities;
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
|
@@ -195,3 +196,4 @@ namespace Backend.Features.Subscriptions
|
|
| 195 |
}
|
| 196 |
}
|
| 197 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using DbConnect.Data;
|
| 3 |
using DbConnect.Entities;
|
| 4 |
using Microsoft.EntityFrameworkCore;
|
|
|
|
| 196 |
}
|
| 197 |
}
|
| 198 |
}
|
| 199 |
+
|
Backend/Features/Users/UserController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
|
|
@@ -95,3 +96,4 @@ namespace Backend.Features.Users
|
|
| 95 |
}
|
| 96 |
}
|
| 97 |
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Mvc;
|
| 4 |
|
|
|
|
| 96 |
}
|
| 97 |
}
|
| 98 |
|
| 99 |
+
|
Backend/Features/Users/UserService.cs
CHANGED
|
@@ -3,6 +3,7 @@ using DbConnect.Entities;
|
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
| 4 |
using Backend.Features.Subscriptions;
|
| 5 |
using Backend.Features.Loyalty;
|
|
|
|
| 6 |
using System;
|
| 7 |
using System.Collections.Generic;
|
| 8 |
using System.Linq;
|
|
@@ -170,44 +171,4 @@ namespace Backend.Features.Users
|
|
| 170 |
};
|
| 171 |
}
|
| 172 |
}
|
| 173 |
-
|
| 174 |
-
public class UserDto
|
| 175 |
-
{
|
| 176 |
-
public Guid Id { get; set; }
|
| 177 |
-
public string Name => FullName;
|
| 178 |
-
public string FullName { get; set; } = string.Empty;
|
| 179 |
-
public string Email { get; set; } = string.Empty;
|
| 180 |
-
public string? PhoneNumber { get; set; }
|
| 181 |
-
public string Role { get; set; } = string.Empty;
|
| 182 |
-
public bool IsActive { get; set; }
|
| 183 |
-
public string? StudentId { get; set; }
|
| 184 |
-
public string? Address { get; set; }
|
| 185 |
-
public DateTime CreatedAt { get; set; }
|
| 186 |
-
public DateTime? UpdatedAt { get; set; }
|
| 187 |
-
public bool? BanStatus { get; set; }
|
| 188 |
-
public DateTime? SuspensionEndDate { get; set; }
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
public class UserCreateRequest
|
| 192 |
-
{
|
| 193 |
-
public string FullName { get; set; } = string.Empty;
|
| 194 |
-
public string Email { get; set; } = string.Empty;
|
| 195 |
-
public string Password { get; set; } = string.Empty;
|
| 196 |
-
public string? PhoneNumber { get; set; }
|
| 197 |
-
public string? StudentId { get; set; }
|
| 198 |
-
public string? Address { get; set; }
|
| 199 |
-
}
|
| 200 |
-
|
| 201 |
-
public class UserUpdateRequest
|
| 202 |
-
{
|
| 203 |
-
public string FullName { get; set; } = string.Empty;
|
| 204 |
-
public string? PhoneNumber { get; set; }
|
| 205 |
-
public string? StudentId { get; set; }
|
| 206 |
-
public string? Address { get; set; }
|
| 207 |
-
}
|
| 208 |
-
|
| 209 |
-
public class UserRoleUpdateRequest
|
| 210 |
-
{
|
| 211 |
-
public string Role { get; set; } = string.Empty;
|
| 212 |
-
}
|
| 213 |
}
|
|
|
|
| 3 |
using Microsoft.EntityFrameworkCore;
|
| 4 |
using Backend.Features.Subscriptions;
|
| 5 |
using Backend.Features.Loyalty;
|
| 6 |
+
using LibraryManagement.Shared.Models;
|
| 7 |
using System;
|
| 8 |
using System.Collections.Generic;
|
| 9 |
using System.Linq;
|
|
|
|
| 171 |
};
|
| 172 |
}
|
| 173 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
}
|
Backend/Features/Wishlist/WishlistController.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
using Microsoft.AspNetCore.Authorization;
|
| 2 |
using Microsoft.AspNetCore.Mvc;
|
| 3 |
using System.Security.Claims;
|
|
@@ -45,3 +46,4 @@ namespace Backend.Features.Wishlist
|
|
| 45 |
}
|
| 46 |
}
|
| 47 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Mvc;
|
| 4 |
using System.Security.Claims;
|
|
|
|
| 46 |
}
|
| 47 |
}
|
| 48 |
}
|
| 49 |
+
|
Backend/Program.cs
CHANGED
|
@@ -20,10 +20,10 @@ using Google.Apis.Auth.OAuth2;
|
|
| 20 |
var builder = WebApplication.CreateBuilder(args);
|
| 21 |
|
| 22 |
// Firebase Admin SDK Initialization
|
| 23 |
-
FirebaseApp.Create(new AppOptions()
|
| 24 |
-
{
|
| 25 |
-
Credential = GoogleCredential.FromFile("LibraryFirebase.json")
|
| 26 |
-
});
|
| 27 |
|
| 28 |
|
| 29 |
builder.Services.AddControllers();
|
|
|
|
| 20 |
var builder = WebApplication.CreateBuilder(args);
|
| 21 |
|
| 22 |
// Firebase Admin SDK Initialization
|
| 23 |
+
//FirebaseApp.Create(new AppOptions()
|
| 24 |
+
//{
|
| 25 |
+
// Credential = GoogleCredential.FromFile("LibraryFirebase.json")
|
| 26 |
+
//});
|
| 27 |
|
| 28 |
|
| 29 |
builder.Services.AddControllers();
|
BlazorFrontend/BlazorFrontend.csproj
CHANGED
|
@@ -11,4 +11,8 @@
|
|
| 11 |
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.17.0" />
|
| 12 |
</ItemGroup>
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
</Project>
|
|
|
|
| 11 |
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.17.0" />
|
| 12 |
</ItemGroup>
|
| 13 |
|
| 14 |
+
<ItemGroup>
|
| 15 |
+
<ProjectReference Include="..\LibraryManagement.Shared\LibraryManagement.Shared.csproj" />
|
| 16 |
+
</ItemGroup>
|
| 17 |
+
|
| 18 |
</Project>
|
BlazorFrontend/Components/Pages/Books.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Books"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject WishlistService WishlistService
|
|
@@ -727,3 +727,4 @@ else if (_viewMode == ViewMode.Create || _viewMode == ViewMode.Edit)
|
|
| 727 |
public List<int> CategoryIds { get; set; } = new();
|
| 728 |
}
|
| 729 |
}
|
|
|
|
|
|
| 1 |
@page "/Books"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject WishlistService WishlistService
|
|
|
|
| 727 |
public List<int> CategoryIds { get; set; } = new();
|
| 728 |
}
|
| 729 |
}
|
| 730 |
+
|
BlazorFrontend/Components/Pages/Borrowings.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Borrowings"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@inject LibraryApiClient ApiClient
|
| 5 |
@inject IJSRuntime JS
|
| 6 |
|
|
@@ -194,3 +194,4 @@ else
|
|
| 194 |
}
|
| 195 |
}
|
| 196 |
|
|
|
|
|
|
| 1 |
@page "/Borrowings"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@inject LibraryApiClient ApiClient
|
| 5 |
@inject IJSRuntime JS
|
| 6 |
|
|
|
|
| 194 |
}
|
| 195 |
}
|
| 196 |
|
| 197 |
+
|
BlazorFrontend/Components/Pages/BorrowingsManage.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Borrowings/Manage"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject IJSRuntime JS
|
|
@@ -253,3 +253,4 @@ else
|
|
| 253 |
}
|
| 254 |
}
|
| 255 |
|
|
|
|
|
|
| 1 |
@page "/Borrowings/Manage"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject IJSRuntime JS
|
|
|
|
| 253 |
}
|
| 254 |
}
|
| 255 |
|
| 256 |
+
|
BlazorFrontend/Components/Pages/Home.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject AuthenticationStateProvider AuthStateProvider
|
|
@@ -241,3 +241,4 @@ else
|
|
| 241 |
}
|
| 242 |
}
|
| 243 |
|
|
|
|
|
|
| 1 |
@page "/"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject AuthenticationStateProvider AuthStateProvider
|
|
|
|
| 241 |
}
|
| 242 |
}
|
| 243 |
|
| 244 |
+
|
BlazorFrontend/Components/Pages/Login.razor
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
@using BlazorFrontend.Services
|
| 4 |
@using BlazorFrontend.Providers
|
| 5 |
-
@using
|
| 6 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 7 |
@inject HttpClient Http
|
| 8 |
@inject AuthenticationStateProvider AuthStateProvider
|
|
@@ -112,3 +112,4 @@
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
}
|
|
|
|
|
|
| 2 |
|
| 3 |
@using BlazorFrontend.Services
|
| 4 |
@using BlazorFrontend.Providers
|
| 5 |
+
@using LibraryManagement.Shared.Models
|
| 6 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 7 |
@inject HttpClient Http
|
| 8 |
@inject AuthenticationStateProvider AuthStateProvider
|
|
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
}
|
| 115 |
+
|
BlazorFrontend/Components/Pages/Members.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Members"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using BlazorFrontend.Models
|
| 5 |
@using Microsoft.AspNetCore.Authorization
|
| 6 |
@attribute [Authorize(Roles = "Librarian")]
|
|
@@ -632,3 +632,4 @@ else if (_currentView == ViewMode.Create || _currentView == ViewMode.Edit)
|
|
| 632 |
}
|
| 633 |
}
|
| 634 |
|
|
|
|
|
|
| 1 |
@page "/Members"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using BlazorFrontend.Models
|
| 5 |
@using Microsoft.AspNetCore.Authorization
|
| 6 |
@attribute [Authorize(Roles = "Librarian")]
|
|
|
|
| 632 |
}
|
| 633 |
}
|
| 634 |
|
| 635 |
+
|
BlazorFrontend/Components/Pages/Membership.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Membership"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using BlazorFrontend.Models
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject IJSRuntime JSRuntime
|
|
@@ -318,3 +318,4 @@ else if (_viewModel != null)
|
|
| 318 |
}
|
| 319 |
}
|
| 320 |
|
|
|
|
|
|
| 1 |
@page "/Membership"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using BlazorFrontend.Models
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject IJSRuntime JSRuntime
|
|
|
|
| 318 |
}
|
| 319 |
}
|
| 320 |
|
| 321 |
+
|
BlazorFrontend/Components/Pages/Notifications.razor
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
@page "/notifications"
|
| 2 |
-
@using
|
| 3 |
@using Microsoft.AspNetCore.Authorization
|
| 4 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 5 |
@using BlazorFrontend.Services
|
|
@@ -156,3 +156,4 @@
|
|
| 156 |
}
|
| 157 |
}
|
| 158 |
}
|
|
|
|
|
|
| 1 |
@page "/notifications"
|
| 2 |
+
@using LibraryManagement.Shared.Models
|
| 3 |
@using Microsoft.AspNetCore.Authorization
|
| 4 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 5 |
@using BlazorFrontend.Services
|
|
|
|
| 156 |
}
|
| 157 |
}
|
| 158 |
}
|
| 159 |
+
|
BlazorFrontend/Components/Pages/Register.razor
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
@using BlazorFrontend.Services
|
| 4 |
@using BlazorFrontend.Providers
|
| 5 |
-
@using
|
| 6 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 7 |
@inject HttpClient Http
|
| 8 |
@inject NavigationManager Navigation
|
|
@@ -110,3 +110,4 @@
|
|
| 110 |
}
|
| 111 |
}
|
| 112 |
}
|
|
|
|
|
|
| 2 |
|
| 3 |
@using BlazorFrontend.Services
|
| 4 |
@using BlazorFrontend.Providers
|
| 5 |
+
@using LibraryManagement.Shared.Models
|
| 6 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 7 |
@inject HttpClient Http
|
| 8 |
@inject NavigationManager Navigation
|
|
|
|
| 110 |
}
|
| 111 |
}
|
| 112 |
}
|
| 113 |
+
|
BlazorFrontend/Components/Pages/Rewards.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Rewards"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@inject LibraryApiClient ApiClient
|
| 5 |
@inject IJSRuntime JS
|
| 6 |
|
|
@@ -293,3 +293,4 @@ else
|
|
| 293 |
}
|
| 294 |
}
|
| 295 |
|
|
|
|
|
|
| 1 |
@page "/Rewards"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@inject LibraryApiClient ApiClient
|
| 5 |
@inject IJSRuntime JS
|
| 6 |
|
|
|
|
| 293 |
}
|
| 294 |
}
|
| 295 |
|
| 296 |
+
|
BlazorFrontend/Components/Pages/RewardsManage.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Rewards/Manage"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject IJSRuntime JS
|
|
@@ -312,3 +312,4 @@ else
|
|
| 312 |
}
|
| 313 |
}
|
| 314 |
|
|
|
|
|
|
| 1 |
@page "/Rewards/Manage"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject LibraryApiClient ApiClient
|
| 6 |
@inject IJSRuntime JS
|
|
|
|
| 312 |
}
|
| 313 |
}
|
| 314 |
|
| 315 |
+
|
BlazorFrontend/Components/Pages/UserInsights.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Insights"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@attribute [Authorize(Roles = "Librarian")]
|
| 6 |
@inject LibraryApiClient ApiClient
|
|
@@ -271,3 +271,4 @@ else
|
|
| 271 |
public string ValueLabel { get; set; } = "";
|
| 272 |
}
|
| 273 |
}
|
|
|
|
|
|
| 1 |
@page "/Insights"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@attribute [Authorize(Roles = "Librarian")]
|
| 6 |
@inject LibraryApiClient ApiClient
|
|
|
|
| 271 |
public string ValueLabel { get; set; } = "";
|
| 272 |
}
|
| 273 |
}
|
| 274 |
+
|
BlazorFrontend/Components/Pages/Wishlist.razor
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@page "/Wishlist"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
-
@using
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject WishlistService WishlistService
|
| 6 |
@inject IJSRuntime JS
|
|
@@ -201,3 +201,4 @@
|
|
| 201 |
await JS.InvokeVoidAsync("showToast", "Removed from favourites", "success");
|
| 202 |
}
|
| 203 |
}
|
|
|
|
|
|
| 1 |
@page "/Wishlist"
|
| 2 |
@using BlazorFrontend.Services
|
| 3 |
+
@using LibraryManagement.Shared.Models
|
| 4 |
@using Microsoft.AspNetCore.Authorization
|
| 5 |
@inject WishlistService WishlistService
|
| 6 |
@inject IJSRuntime JS
|
|
|
|
| 201 |
await JS.InvokeVoidAsync("showToast", "Removed from favourites", "success");
|
| 202 |
}
|
| 203 |
}
|
| 204 |
+
|
BlazorFrontend/Components/_Imports.razor
CHANGED
|
@@ -9,3 +9,4 @@
|
|
| 9 |
@using BlazorFrontend
|
| 10 |
@using BlazorFrontend.Components
|
| 11 |
@using Microsoft.AspNetCore.Components.Authorization
|
|
|
|
|
|
| 9 |
@using BlazorFrontend
|
| 10 |
@using BlazorFrontend.Components
|
| 11 |
@using Microsoft.AspNetCore.Components.Authorization
|
| 12 |
+
@using LibraryManagement.Shared.Models
|
BlazorFrontend/Models/Dtos/LoyaltyRedemptionDto.cs
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
using System;
|
| 2 |
-
using System.Text.Json.Serialization;
|
| 3 |
-
|
| 4 |
-
namespace BlazorFrontend.Models.Dtos
|
| 5 |
-
{
|
| 6 |
-
public class LoyaltyRedemptionDto
|
| 7 |
-
{
|
| 8 |
-
[JsonPropertyName("id")]
|
| 9 |
-
public string Id { get; set; } = string.Empty;
|
| 10 |
-
|
| 11 |
-
[JsonPropertyName("systemId")]
|
| 12 |
-
public string SystemId { get; set; } = string.Empty;
|
| 13 |
-
|
| 14 |
-
[JsonPropertyName("externalUserId")]
|
| 15 |
-
public string ExternalUserId { get; set; } = string.Empty;
|
| 16 |
-
|
| 17 |
-
[JsonPropertyName("rewardId")]
|
| 18 |
-
public string? RewardId { get; set; }
|
| 19 |
-
|
| 20 |
-
[JsonPropertyName("rewardName")]
|
| 21 |
-
public string RewardName { get; set; } = string.Empty;
|
| 22 |
-
|
| 23 |
-
[JsonPropertyName("pointCost")]
|
| 24 |
-
public double PointCost { get; set; }
|
| 25 |
-
|
| 26 |
-
[JsonPropertyName("status")]
|
| 27 |
-
public string Status { get; set; } = string.Empty;
|
| 28 |
-
|
| 29 |
-
[JsonPropertyName("redeemedAt")]
|
| 30 |
-
public DateTime RedeemedAt { get; set; }
|
| 31 |
-
}
|
| 32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BlazorFrontend/Models/MemberDetailsViewModel.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
using
|
| 2 |
using System.Collections.Generic;
|
| 3 |
|
| 4 |
namespace BlazorFrontend.Models
|
|
@@ -10,3 +10,4 @@ namespace BlazorFrontend.Models
|
|
| 10 |
public List<MembershipDto> AvailableMemberships { get; set; } = new();
|
| 11 |
}
|
| 12 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using System.Collections.Generic;
|
| 3 |
|
| 4 |
namespace BlazorFrontend.Models
|
|
|
|
| 10 |
public List<MembershipDto> AvailableMemberships { get; set; } = new();
|
| 11 |
}
|
| 12 |
}
|
| 13 |
+
|
BlazorFrontend/Models/MembershipViewModel.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
using
|
| 2 |
using System.Collections.Generic;
|
| 3 |
|
| 4 |
namespace BlazorFrontend.Models
|
|
@@ -12,3 +12,4 @@ namespace BlazorFrontend.Models
|
|
| 12 |
public Dictionary<string, double> RewardPointCosts { get; set; } = new Dictionary<string, double>();
|
| 13 |
}
|
| 14 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using System.Collections.Generic;
|
| 3 |
|
| 4 |
namespace BlazorFrontend.Models
|
|
|
|
| 12 |
public Dictionary<string, double> RewardPointCosts { get; set; } = new Dictionary<string, double>();
|
| 13 |
}
|
| 14 |
}
|
| 15 |
+
|
BlazorFrontend/Models/RewardsViewModel.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
using
|
| 2 |
|
| 3 |
namespace BlazorFrontend.Models
|
| 4 |
{
|
|
@@ -19,3 +19,4 @@ namespace BlazorFrontend.Models
|
|
| 19 |
public IEnumerable<UserPointsHistoryDto> AllMembersHistory { get; set; } = Enumerable.Empty<UserPointsHistoryDto>();
|
| 20 |
}
|
| 21 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
|
| 3 |
namespace BlazorFrontend.Models
|
| 4 |
{
|
|
|
|
| 19 |
public IEnumerable<UserPointsHistoryDto> AllMembersHistory { get; set; } = Enumerable.Empty<UserPointsHistoryDto>();
|
| 20 |
}
|
| 21 |
}
|
| 22 |
+
|
BlazorFrontend/Models/SubscriptionsViewModel.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
using
|
| 2 |
|
| 3 |
namespace BlazorFrontend.Models
|
| 4 |
{
|
|
@@ -8,3 +8,4 @@ namespace BlazorFrontend.Models
|
|
| 8 |
public List<SubscriptionDto> ActiveSubscriptions { get; set; } = new();
|
| 9 |
}
|
| 10 |
}
|
|
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
|
| 3 |
namespace BlazorFrontend.Models
|
| 4 |
{
|
|
|
|
| 8 |
public List<SubscriptionDto> ActiveSubscriptions { get; set; } = new();
|
| 9 |
}
|
| 10 |
}
|
| 11 |
+
|
BlazorFrontend/Services/LibraryApiClient.cs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
using System.Net.Http.Json;
|
| 2 |
using System.Text.Json;
|
| 3 |
-
using
|
| 4 |
|
| 5 |
namespace BlazorFrontend.Services
|
| 6 |
{
|
|
|
|
| 1 |
using System.Net.Http.Json;
|
| 2 |
using System.Text.Json;
|
| 3 |
+
using LibraryManagement.Shared.Models;
|
| 4 |
|
| 5 |
namespace BlazorFrontend.Services
|
| 6 |
{
|
BlazorFrontend/Services/WishlistService.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
using
|
| 2 |
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
| 3 |
using System.Text.Json;
|
| 4 |
|
|
|
|
| 1 |
+
using LibraryManagement.Shared.Models;
|
| 2 |
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
| 3 |
using System.Text.Json;
|
| 4 |
|
BlazorWebAssembly/App.razor
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<Router AppAssembly="@typeof(App).Assembly">
|
| 2 |
+
<Found Context="routeData">
|
| 3 |
+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
| 4 |
+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
| 5 |
+
</Found>
|
| 6 |
+
<NotFound>
|
| 7 |
+
<PageTitle>Not found</PageTitle>
|
| 8 |
+
<LayoutView Layout="@typeof(MainLayout)">
|
| 9 |
+
<p role="alert">Sorry, there's nothing at this address.</p>
|
| 10 |
+
</LayoutView>
|
| 11 |
+
</NotFound>
|
| 12 |
+
</Router>
|
BlazorWebAssembly/BlazorWebAssembly.csproj
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
| 2 |
+
|
| 3 |
+
<PropertyGroup>
|
| 4 |
+
<TargetFramework>net8.0</TargetFramework>
|
| 5 |
+
<Nullable>enable</Nullable>
|
| 6 |
+
<ImplicitUsings>enable</ImplicitUsings>
|
| 7 |
+
</PropertyGroup>
|
| 8 |
+
|
| 9 |
+
<ItemGroup>
|
| 10 |
+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.26" />
|
| 11 |
+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.26" PrivateAssets="all" />
|
| 12 |
+
</ItemGroup>
|
| 13 |
+
|
| 14 |
+
<ItemGroup>
|
| 15 |
+
<ProjectReference Include="..\LibraryManagement.Shared\LibraryManagement.Shared.csproj" />
|
| 16 |
+
</ItemGroup>
|
| 17 |
+
|
| 18 |
+
</Project>
|