public Task <IReadOnlyList <DatabaseBackup> > ListAsync(IDatabaseInfo database) { Ensure.NotNull(database, nameof(database)); var range = ScopedId.GetRange(database.Id); return(db.DatabaseBackups.QueryAsync(Between("id", range.Start, range.End), Order.Descending("id"))); }
public Task <IReadOnlyList <RepositoryCommit> > ListAsync(IRepository repository) { var range = ScopedId.GetRange(repository.Id); return(db.RepositoryCommits.QueryAsync( Between("id", range.Start, range.End), order: Order.Descending("id") )); }
public Task <IReadOnlyList <DatabaseGrant> > ListAsync(IDatabaseInfo database) { Ensure.NotNull(database, nameof(database)); var range = ScopedId.GetRange(database.Id); return(db.DatabaseGrants.QueryAsync( And(Between("id", range.Start, range.End), IsNull("deleted")) )); }
public async Task <IReadOnlyList <DomainRecord> > ListAsync(IDomain domain) { var range = ScopedId.GetRange(domain.Id); // order? return(await db.DomainRecords.QueryAsync( And(Between("id", range.Start, range.End), IsNull("deleted")) )); }
public Task <IReadOnlyList <DomainAuthorization> > ListAsync(IDomain domain) { Ensure.NotNull(domain, nameof(domain)); var range = ScopedId.GetRange(domain.Id); return(db.DomainAuthorizations.QueryAsync( Expression.Between("id", range.Start, range.End) )); }
public static async Task <long> GetNextScopedIdAsync <T>(this Dataset <T, long> dataset, long scopeId) { var range = ScopedId.GetRange(scopeId); // should be max id in range... var count = await dataset.CountAsync( Expression.Between("id", range.Start, range.End) ); return(ScopedId.Create(scopeId, count)); }
public async Task <DomainAuthorization> GetLatestAsync(IDomain domain) { Ensure.NotNull(domain, nameof(domain)); var range = ScopedId.GetRange(domain.Id); return((await db.DomainAuthorizations.QueryAsync( Expression.Between("id", range.Start, range.End), order: Order.Descending("id"), take: 1 )).FirstOrDefault()); }
public Task <IReadOnlyList <DatabaseGrant> > ListAsync(IDatabaseInfo database, IUser user) { Ensure.NotNull(database, nameof(database)); Ensure.NotNull(user, nameof(user)); var range = ScopedId.GetRange(database.Id); return(db.DatabaseGrants.QueryAsync( Conjunction( Between("id", range.Start, range.End), Eq("userId", user.Id), IsNull("deleted") ) )); }