mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-21 09:11:20 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
35 lines
1.3 KiB
C#
Executable file
35 lines
1.3 KiB
C#
Executable file
using Dapper;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FSO.Server.Database.DA.Bookmarks
|
|
{
|
|
public class SqlBookmarks : AbstractSqlDA, IBookmarks
|
|
{
|
|
public SqlBookmarks(ISqlContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public void Create(DbBookmark bookmark)
|
|
{
|
|
Context.Connection.Execute("INSERT INTO fso_bookmarks (avatar_id, type, target_id) " +
|
|
" VALUES (@avatar_id, @type, @target_id)"
|
|
, bookmark);
|
|
}
|
|
|
|
public bool Delete(DbBookmark bookmark)
|
|
{
|
|
return Context.Connection.Execute("DELETE FROM fso_bookmarks WHERE avatar_id = @avatar_id AND type = @type AND target_id = @target_id", bookmark) > 0;
|
|
}
|
|
|
|
public List<DbBookmark> GetByAvatarId(uint avatar_id)
|
|
{
|
|
return Context.Connection.Query<DbBookmark>("SELECT * FROM fso_bookmarks WHERE avatar_id = @avatar_id", new { avatar_id = avatar_id }).ToList();
|
|
}
|
|
|
|
public List<uint> GetAvatarIgnore(uint avatar_id)
|
|
{
|
|
return Context.Connection.Query<uint>("SELECT target_id FROM fso_bookmarks WHERE avatar_id = @avatar_id AND type = 5", new { avatar_id = avatar_id }).ToList();
|
|
}
|
|
}
|
|
}
|