mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
User management stuff
This commit is contained in:
parent
0828756171
commit
b851d77364
17 changed files with 232 additions and 94 deletions
|
@ -87,6 +87,7 @@
|
|||
<Compile Include="Repository\GenericRepository.cs" />
|
||||
<Compile Include="RequestedModel.cs" />
|
||||
<Compile Include="UserEntity.cs" />
|
||||
<Compile Include="UserLogins.cs" />
|
||||
<Compile Include="UsersModel.cs" />
|
||||
<Compile Include="UserRepository.cs" />
|
||||
<Compile Include="Sql.Designer.cs">
|
||||
|
|
|
@ -11,6 +11,15 @@ CREATE TABLE IF NOT EXISTS Users
|
|||
UserProperties BLOB
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS UserLogins
|
||||
(
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
UserId varchar(50) NOT NULL ,
|
||||
Type INTEGER NOT NULL,
|
||||
LastLoggedIn varchar(100) NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS UserLogins_UserId ON UserLogins (UserId);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS GlobalSettings
|
||||
(
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace PlexRequests.Store
|
|||
}
|
||||
}
|
||||
|
||||
public static void AddColumn(this IDbConnection connection, string tableName, string alterType, string newColumn, bool isNullable, string dataType)
|
||||
public static void AddColumn(this IDbConnection connection, string tableName, string alterType, string newColumn, bool allowNulls, string dataType)
|
||||
{
|
||||
connection.Open();
|
||||
var result = connection.Query<TableInfo>($"PRAGMA table_info({tableName});");
|
||||
|
@ -67,7 +67,7 @@ namespace PlexRequests.Store
|
|||
}
|
||||
|
||||
var query = $"ALTER TABLE {tableName} {alterType} {newColumn} {dataType}";
|
||||
if (isNullable)
|
||||
if (!allowNulls)
|
||||
{
|
||||
query = query + " NOT NULL";
|
||||
}
|
||||
|
|
41
PlexRequests.Store/UserLogins.cs
Normal file
41
PlexRequests.Store/UserLogins.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: UserLogins.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Dapper.Contrib.Extensions;
|
||||
using PlexRequests.Helpers;
|
||||
|
||||
namespace PlexRequests.Store
|
||||
{
|
||||
[Table("UserLogins")]
|
||||
public class UserLogins : Entity
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public UserType Type { get; set; }
|
||||
public DateTime LastLoggedIn { get; set; }
|
||||
}
|
||||
}
|
|
@ -24,6 +24,8 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Dapper.Contrib.Extensions;
|
||||
|
||||
namespace PlexRequests.Store
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue