Skip to content

Commit 18eb68e

Browse files
eugbyteCopilot
andauthored
fix: warnings (#38)
* fix: warnings * fix: fmt * fix: test * chore: revert tf * chore: revert tf * chore: fmt * Update src/Evently.Server/Common/Extensions/LoggerExtension.cs Co-authored-by: Copilot <[email protected]> * fix: fmt --------- Co-authored-by: Copilot <[email protected]>
1 parent 7af44f4 commit 18eb68e

File tree

19 files changed

+108
-96
lines changed

19 files changed

+108
-96
lines changed

Evently.slnx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<Solution>
2-
<Folder Name="/deploy/">
3-
<Project Path="deploy\Terraform\Terraform.csproj" />
4-
</Folder>
5-
<Folder Name="/Solution Items/">
6-
<File Path=".editorconfig" />
7-
<File Path=".gitignore" />
8-
<File Path="Makefile" />
9-
<File Path="docker-compose.yml" />
10-
<File Path=".dockerignore" />
11-
<File Path="README.md" />
12-
</Folder>
13-
<Folder Name="/src/">
14-
<Project Path="src\evently.client\evently.client.esproj">
15-
<Configuration Solution="Release|Any CPU" Project="Debug|Any CPU" />
16-
</Project>
17-
<Project Path="src\Evently.Server\Evently.Server.csproj" />
18-
</Folder>
19-
<Folder Name="/tests/">
20-
<Project Path="tests\Evently.Server.Test\Evently.Server.Test.csproj" />
21-
</Folder>
2+
<Folder Name="/deploy/">
3+
<Project Path="deploy\Terraform\Terraform.csproj"/>
4+
</Folder>
5+
<Folder Name="/Solution Items/">
6+
<File Path=".editorconfig"/>
7+
<File Path=".gitignore"/>
8+
<File Path="Makefile"/>
9+
<File Path="docker-compose.yml"/>
10+
<File Path=".dockerignore"/>
11+
<File Path="README.md"/>
12+
</Folder>
13+
<Folder Name="/src/">
14+
<Project Path="src\evently.client\evently.client.esproj">
15+
<Configuration Solution="Release|Any CPU" Project="Debug|Any CPU"/>
16+
</Project>
17+
<Project Path="src\Evently.Server\Evently.Server.csproj"/>
18+
</Folder>
19+
<Folder Name="/tests/">
20+
<Project Path="tests\Evently.Server.Test\Evently.Server.Test.csproj"/>
21+
</Folder>
2222
</Solution>

README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Evently - Event Management Application
22

3-
A modern, full-stack event management platform built with .NET and React, designed to streamline event organization and management processes.
3+
A modern, full-stack event management platform built with .NET and React, designed to streamline event organization and
4+
management processes.
45

56
## 📋 Features
7+
68
- 🎫 **Event Creation & Management** - Create and manage events with detailed information
79
- 👥 **User Authentication** - Google OAuth integration
810
- 📱 **QR Code Support** - Generate and scan QR codes for events
@@ -12,17 +14,20 @@ A modern, full-stack event management platform built with .NET and React, design
1214
- 📱 **Progressive Web App** - Mobile-friendly experience
1315
- 🔍 **Advanced Search & Filtering** - Find events easily
1416

15-
1617
## 🚀 Quick Start
1718

1819
### 🌐 Live Demo
19-
Experience Evently in action: [Website](https://ca-evently-prod-sea.graybush-4e3751bc.southeastasia.azurecontainerapps.io/)
20+
21+
Experience Evently in
22+
action: [Website](https://ca-evently-prod-sea.graybush-4e3751bc.southeastasia.azurecontainerapps.io/)
2023

2124
### 🐳 Docker (Recommended)
25+
2226
Get up and running in minutes with Docker:
2327

2428
Update your `docker-compose.yml` with your email and Google OAuth Client credentials. If omitted,
2529
the application can still run, just that the authentication and email features won't work:
30+
2631
```yaml
2732
environment:
2833
# ... other environment variables ...
@@ -42,15 +47,17 @@ docker-compose up --build
4247
# Website: http://localhost:4000
4348
```
4449

45-
4650
## 🛠 Tech Stack
51+
4752
### ⚙️ Backend
53+
4854
- **Framework**: .NET 9.0 with ASP.NET Core
4955
- **Language**: C# 13.0
5056
- **UI Framework**: Blazor Server components
5157
- **Architecture**: Web API with MVC pattern
5258

5359
### 🎨 Frontend
60+
5461
- **Framework**: React 19
5562
- **Language**: TypeScript 5
5663
- **Routing**: TanStack Router v1
@@ -59,13 +66,15 @@ docker-compose up --build
5966
- **Build Tool**: Vite 7
6067

6168
### 🏗️ Infrastructure & DevOps
69+
6270
- **CI/CD**: GitHub Actions
6371
- **Cloud**: Azure
6472
- **IAC**: Terraform
6573

6674
## 🏁 Getting Started
6775

6876
### Prerequisites
77+
6978
- .NET 9.0 SDK
7079
- Node.js (with npm/pnpm)
7180
- Docker (optional)
@@ -97,13 +106,16 @@ docker-compose up --build
97106
```
98107

99108
## 🧪 Testing
109+
100110
The project includes a comprehensive testing setup:
111+
101112
- **Testing Framework**: Vitest 3.2.4
102113
- **React Testing**: React Testing Library 16.3.0
103114
- **DOM Testing**: Testing Library DOM 10.4.1
104115
- **User Interaction Testing**: User Event 14.6.1
105116

106117
Run tests:
118+
107119
``` bash
108120
# Backend tests
109121
dotnet test tests/Evently.Server.Test/
@@ -112,23 +124,28 @@ dotnet test tests/Evently.Server.Test/
112124
cd src/evently.client && pnpm test
113125
```
114126

115-
116127
## 🔧 Development
128+
117129
### Code Quality
130+
118131
The project maintains high code quality standards with:
132+
119133
- **ESLint**: JavaScript/TypeScript linting
120134
- **Prettier**: Code formatting
121135
- **EditorConfig**: Consistent coding styles
122136
- **TypeScript**: Strong typing for frontend
123137

124138
### Build Tools
139+
125140
- **Vite**: Fast development server and build tool
126141
- **Makefile**: Standardized build commands
127142
- **Docker Compose**: Development environment orchestration
128143

129144
### 📁 Project Structure
130-
The project follows a **Feature Folder Structure** or **Vertical Slice Architecture** pattern,
131-
organizing code by business features rather than technical layers. This approach encourages modularity and separation of concerns.
145+
146+
The project follows a **Feature Folder Structure** or **Vertical Slice Architecture** pattern,
147+
organizing code by business features rather than technical layers. This approach encourages modularity and separation of
148+
concerns.
132149

133150
```
134151
evently/

src/Evently.Server/Common/Adapters/Data/AppDbContext.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using Evently.Server.Common.Domains.Entities;
22
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
33
using Microsoft.EntityFrameworkCore;
4+
using Microsoft.EntityFrameworkCore.Metadata;
5+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6+
using System.Reflection;
47

58
namespace Evently.Server.Common.Adapters.Data;
69

@@ -14,6 +17,11 @@ public class AppDbContext(DbContextOptions<AppDbContext> options) : IdentityDbCo
1417
protected override void OnModelCreating(ModelBuilder modelBuilder) {
1518
base.OnModelCreating(modelBuilder);
1619

20+
// for unit testing, sqlite is used
21+
if (Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite") {
22+
ConfigureSqlite(modelBuilder);
23+
}
24+
1725
// Postgres identity configuration
1826
modelBuilder.Entity<Gathering>().Property(g => g.GatheringId)
1927
.HasIdentityOptions(startValue: 20);
@@ -260,4 +268,23 @@ private static void SeedData(ModelBuilder modelBuilder) {
260268
}
261269
);
262270
}
271+
272+
// https://stackoverflow.com/a/76152994/6514532
273+
private static void ConfigureSqlite(ModelBuilder modelBuilder) {
274+
// SQLite does not have proper support for DateTimeOffset via Entity Framework Core,
275+
// see the limitations here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations.
276+
// Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754.
277+
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes()) {
278+
IEnumerable<PropertyInfo> properties = entityType.ClrType
279+
.GetProperties()
280+
.Where(p => p.PropertyType == typeof(DateTimeOffset)
281+
|| p.PropertyType == typeof(DateTimeOffset?));
282+
foreach (PropertyInfo property in properties) {
283+
modelBuilder
284+
.Entity(entityType.Name)
285+
.Property(property.Name)
286+
.HasConversion(new DateTimeOffsetToBinaryConverter());
287+
}
288+
}
289+
}
263290
}

src/Evently.Server/Common/Domains/Entities/Booking.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public class Booking {
1616
[StringLength(50)]
1717
public string BookingId { get; set; } = $"book_{Nanoid.Generate(size: 10)}";
1818

19-
[ForeignKey("Account")] public string AttendeeId { get; set; } = string.Empty;
19+
[ForeignKey("Account")]
20+
[SuppressMessage("ReSharper", "EntityFramework.ModelValidation.UnlimitedStringLength", Justification = "MSSQL does not allow specified string limit")]
21+
public string AttendeeId { get; set; } = string.Empty;
2022
[JsonIgnore] public Account? Account { get; set; }
2123
[NotMapped] public AccountDto? AccountDto => Account?.ToAccountDto();
2224

src/Evently.Server/Common/Domains/Interfaces/IBookingService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ Task<PageResult<Booking>> GetBookings(string? accountId, long? gatheringId,
1111
bool? isCancelled, int? offset, int? limit);
1212
Task<Booking> CreateBooking(BookingReqDto bookingReqDto);
1313
Task<Booking> UpdateBooking(string bookingId, BookingReqDto bookingReqDto);
14-
Task<bool> Exists(string bookingId);
1514
Task<string> RenderTicket(string bookingId);
1615
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
namespace Evently.Server.Common.Domains.Models;
1+
using JetBrains.Annotations;
22

3+
namespace Evently.Server.Common.Domains.Models;
4+
5+
[UsedImplicitly]
36
public sealed record AccountDto(string Id, string Email, string Username, string Name);
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Evently.Server.Common.Domains.Models;
1+
using JetBrains.Annotations;
22

3-
// [{"categoryId":1,"gatheringId":22},{"categoryId":2,"gatheringId":22}]
3+
namespace Evently.Server.Common.Domains.Models;
4+
5+
[UsedImplicitly]
46
public sealed record GatheringCategoryDetailDto(long GatheringId, long CategoryId);

src/Evently.Server/Common/Extensions/LoggerExtension.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@ public static partial void LogCallbackUrl(
2121
Message = "Email sent successfully to {email}")]
2222
public static partial void LogSuccessEmail(
2323
this ILogger logger, string? email);
24+
25+
[LoggerMessage(
26+
EventId = 4,
27+
Level = LogLevel.Error,
28+
Message = "Error occurred at {context}: {errorMsg}")]
29+
public static partial void LogErrorContext(
30+
this ILogger logger, string context, string errorMsg);
2431
}

src/Evently.Server/Common/Extensions/MapperExtension.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,6 @@ public static Gathering ToGathering(this GatheringReqDto gatheringReqDto) {
2626
return gathering;
2727
}
2828

29-
public static GatheringReqDto ToGatheringDto(this Gathering gathering) {
30-
List<GatheringCategoryDetailDto> gatheringCategoryDetails = gathering.GatheringCategoryDetails
31-
.Select(detail => new GatheringCategoryDetailDto(detail.GatheringId, detail.CategoryId))
32-
.ToList();
33-
GatheringReqDto reqDto = new(
34-
gathering.GatheringId,
35-
gathering.Name,
36-
gathering.Description,
37-
gathering.Start,
38-
gathering.End,
39-
gathering.CancellationDateTime,
40-
gathering.Location,
41-
gathering.OrganiserId,
42-
gathering.CoverSrc,
43-
gatheringCategoryDetails
44-
);
45-
return reqDto;
46-
}
47-
48-
4929
public static Booking ToBooking(this BookingReqDto bookingReqDto) {
5030
return new Booking {
5131
BookingId = bookingReqDto.BookingId,

src/Evently.Server/Common/Extensions/UtilsExtension.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
1-
using Microsoft.AspNetCore.Hosting.Server;
2-
using Microsoft.AspNetCore.Hosting.Server.Features;
3-
4-
namespace Evently.Server.Common.Extensions;
1+
namespace Evently.Server.Common.Extensions;
52

63
public static class UtilsExtension {
7-
public static Uri? RootUri(this IServer server) {
8-
IServerAddressesFeature? addressesFeature = server.Features.Get<IServerAddressesFeature>();
9-
if (addressesFeature is null) {
10-
return null;
11-
}
12-
13-
List<string> addresses = addressesFeature.Addresses.ToList();
14-
string address = addresses[0];
15-
16-
UriBuilder uriBuilder = new(address);
17-
return uriBuilder.Uri;
18-
}
19-
204
public static Uri RootUri(this HttpRequest request) {
215
UriBuilder uriBuilder = new() {
226
Scheme = request.Scheme,

0 commit comments

Comments
 (0)