mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-22 01:12:24 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
33 lines
1 KiB
C#
Executable file
33 lines
1 KiB
C#
Executable file
using System.Linq;
|
|
using Dapper;
|
|
|
|
namespace FSO.Server.Database.DA.AuthTickets
|
|
{
|
|
public class SqlAuthTickets : AbstractSqlDA, IAuthTickets
|
|
{
|
|
public SqlAuthTickets(ISqlContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public void Create(AuthTicket ticket)
|
|
{
|
|
Context.Connection.Execute("INSERT INTO fso_auth_tickets VALUES (@ticket_id, @user_id, @date, @ip)", ticket);
|
|
}
|
|
|
|
public void Delete(string id)
|
|
{
|
|
Context.Connection.Execute("DELETE FROM fso_auth_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id });
|
|
}
|
|
|
|
public AuthTicket Get(string id)
|
|
{
|
|
return
|
|
Context.Connection.Query<AuthTicket>("SELECT * FROM fso_auth_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id }).FirstOrDefault();
|
|
}
|
|
|
|
public void Purge(uint time)
|
|
{
|
|
Context.Connection.Execute("DELETE FROM fso_auth_tickets WHERE date < @time", new { time = time });
|
|
}
|
|
}
|
|
}
|