chore: rename SharpbinV3 dir to SharpbinV3.Server

This commit is contained in:
2025-12-30 12:39:26 -05:00
parent 31142e0cf9
commit 1ec4877aad
45 changed files with 7 additions and 94 deletions
+43
View File
@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore;
using SharpbinV3.Server.Data;
using SharpbinV3.Server.Data.Entities;
namespace SharpbinV3.Server.Services
{
public sealed class UserService(AppDbContext db) : IUserService
{
private readonly AppDbContext _db = db;
public Task<User?> GetByUID(int uid, bool withPastes = false)
{
IQueryable<User> query = _db.Users;
if (withPastes)
query = query.Include(u => u.Pastes);
return query.FirstOrDefaultAsync(u => u.UID == uid);
}
public Task<User?> GetByUUID(Guid uuid, bool withPastes = false)
{
IQueryable<User> query = _db.Users;
if (withPastes)
query = query.Include(u => u.Pastes);
return query.FirstOrDefaultAsync(u => u.UUID == uuid);
}
public Task<User?> GetByUsername(string username, bool withPastes = false)
{
IQueryable<User> query = _db.Users;
if (withPastes)
query = query.Include(u => u.Pastes);
return query.FirstOrDefaultAsync(u => u.Username == username);
}
public Task<User?> GetByEmail(string email, bool withPastes = false)
{
IQueryable<User> query = _db.Users;
if (withPastes)
query = query.Include(u => u.Pastes);
return query.FirstOrDefaultAsync(u => u.Email == email);
}
}
}