mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
chore: rename SharpbinV3 dir to SharpbinV3.Server
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user