mirror of
https://github.com/bitwarden/server
synced 2026-01-04 17:43:53 +00:00
user premium validation job
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Bit.Core.Repositories
|
||||
{
|
||||
public interface IOrganizationRepository : IRepository<Organization, Guid>
|
||||
{
|
||||
Task<ICollection<Organization>> GetManyAsync();
|
||||
Task<ICollection<Organization>> GetManyByEnabledAsync();
|
||||
Task<ICollection<Organization>> GetManyByUserIdAsync(Guid userId);
|
||||
Task UpdateStorageAsync(Guid id);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
@@ -7,6 +8,7 @@ namespace Bit.Core.Repositories
|
||||
public interface IUserRepository : IRepository<User, Guid>
|
||||
{
|
||||
Task<User> GetByEmailAsync(string email);
|
||||
Task<ICollection<User>> GetManyByPremiumAsync(bool premium);
|
||||
Task<string> GetPublicKeyAsync(Guid id);
|
||||
Task<DateTime> GetAccountRevisionDateAsync(Guid id);
|
||||
Task UpdateStorageAsync(Guid id);
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
: base(connectionString)
|
||||
{ }
|
||||
|
||||
public async Task<ICollection<Organization>> GetManyAsync()
|
||||
public async Task<ICollection<Organization>> GetManyByEnabledAsync()
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<Organization>(
|
||||
"[dbo].[Organization_Read]",
|
||||
"[dbo].[Organization_ReadByEnabled]",
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.ToList();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
@@ -36,6 +37,19 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<User>> GetManyByPremiumAsync(bool premium)
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<User>(
|
||||
"[dbo].[User_ReadByPremium]",
|
||||
new { Premium = premium },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetPublicKeyAsync(Guid id)
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
|
||||
Reference in New Issue
Block a user