Add backend structure with Docker support and initial configuration files
Java CI / build (push) Successful in 1m56s

Signed-off-by: Dmitrii <computer@yawaflua.tech>

Took 4 hours 25 minutes
This commit is contained in:
Dmitrii
2026-06-28 08:20:33 +03:00
parent 7862597f45
commit eee0d44c92
46 changed files with 3141 additions and 125 deletions
@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using MongoDB.EntityFrameworkCore.Extensions;
using SpMega.Backend.Persistent.Models.Transactions;
using SpMega.Backend.Persistent.Models.Users;
namespace SpMega.Backend.Persistent.Database;
public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
internal DbSet<Transaction> Transactions { get; set; }
internal DbSet<User> Users { get; set; }
internal DbSet<UserSession> UserSessions { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
@@ -0,0 +1,15 @@
namespace SpMega.Backend.Persistent.Models.DTO;
public class PropertyDto
{
public string Name { get; set; }
public string Value { get; set; }
public string Signature { get; set; }
}
public class MojangDto
{
public string Id { get; set; }
public string Name { get; set; }
public List<PropertyDto> Properties { get; set; }
}
@@ -0,0 +1,15 @@
using SPWorldsApi.Types.Interfaces;
namespace SpMega.Backend.Persistent.Models.DTO;
public class UserAccountDTO : IUserAccount
{
public string id { get; set; }
public string username { get; set; }
public string minecraftUUID { get; set; }
public string status { get; set; }
public List<string> roles { get; set; }
public ICity city { get; set; }
public List<IUserCard> cards { get; set; }
public DateTime createdAt { get; set; }
}
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
using SpMega.Backend.Persistent.Models.Users;
namespace SpMega.Backend.Persistent.Models.Transactions;
public class Transaction
{
public Guid Id { get; set; }
public string ShortId { get; set; } = Program.GenerateRandomString(8);
public string ReceiverName { get; set; }
public string ReceiverCardNumber { get; set; }
[JsonIgnore] public User Sender { get; set; }
public string SenderCardNumber { get; set; }
public int Amount { get; set; } = 0;
public string Comment { get; set; } = "";
public DateTime TransactionDate { get; set; } = DateTime.UtcNow;
}
@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
namespace SpMega.Backend.Persistent.Models.Users;
[Owned]
public class Card
{
public Guid Id { get; set; }
public string Name { get; set; }
public string SpworldsID { get; set; }
public string Token { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; }
public DateTime? DeletedAt { get; set; }
public bool IsDeleted { get; set; } = false;
}
@@ -0,0 +1,18 @@
using SpMega.Backend.Persistent.Models.Transactions;
namespace SpMega.Backend.Persistent.Models.Users;
public class User
{
public Guid Id { get; set; }
public string Username { get; set; }
public string Token { get; set; }
public List<Card> Cards { get; set; } = [];
public List<Transaction> Transactions { get; set; } = [];
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; }
public DateTime? DeletedAt { get; set; }
public bool IsDeleted { get; set; } = false;
}
@@ -0,0 +1,15 @@
namespace SpMega.Backend.Persistent.Models.Users;
public class UserSession
{
public Guid Id { get; set; }
public string Token { get; set; }
public User? User { get; set; } = null;
public Guid UserId { get; set; }
public string UserName { get; set; }
public DateTime CreatedAt { get; init; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; }
public DateTime? DeletedAt { get; set; }
public bool IsDeleted { get; set; } = false;
}