mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-21 08:42:27 +00:00
Resolve merge conflicts
This commit is contained in:
commit
c9421b6d23
22 changed files with 287 additions and 93 deletions
|
@ -1,5 +1,3 @@
|
|||
//#nullable enable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -11,16 +9,15 @@ namespace ProjectLighthouse {
|
|||
public DbSet<User> Users { get; set; }
|
||||
public DbSet<Location> Locations { get; set; }
|
||||
public DbSet<Slot> Slots { get; set; }
|
||||
|
||||
public DbSet<QueuedLevel> QueuedLevels { get; set; }
|
||||
public DbSet<Comment> Comments { get; set; }
|
||||
public DbSet<Token> Tokens { get; set; }
|
||||
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseMySql(
|
||||
ServerSettings.DbConnectionString,
|
||||
MySqlServerVersion.LatestSupportedServerVersion
|
||||
);
|
||||
|
||||
|
||||
public async Task<User> CreateUser(string username) {
|
||||
Location l = new(); // store to get id after submitting
|
||||
this.Locations.Add(l); // add to table
|
||||
|
@ -29,7 +26,7 @@ namespace ProjectLighthouse {
|
|||
User user = new() {
|
||||
Username = username,
|
||||
LocationId = l.Id,
|
||||
Biography = "No biography provided",
|
||||
Biography = username + " hasn't introduced themselves yet.",
|
||||
Pins = "",
|
||||
PlanetHash = "",
|
||||
};
|
||||
|
@ -63,7 +60,9 @@ namespace ProjectLighthouse {
|
|||
public async Task<User?> UserFromAuthToken(string authToken) {
|
||||
Token? token = await Tokens.FirstOrDefaultAsync(t => t.UserToken == authToken);
|
||||
if(token == null) return null;
|
||||
return await Users.FirstOrDefaultAsync(u => u.UserId == token.UserId);
|
||||
return await Users
|
||||
.Include(u => u.Location)
|
||||
.FirstOrDefaultAsync(u => u.UserId == token.UserId);
|
||||
}
|
||||
|
||||
public async Task<User?> UserFromRequest(HttpRequest request) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue