feat(EnvelopeReceiverRepository): Standardwert readOnly als true aktualisiert.

This commit is contained in:
Developer 02 2024-12-10 22:43:53 +01:00
parent f0f1275e75
commit f06b41492e
2 changed files with 14 additions and 14 deletions

View File

@ -5,19 +5,19 @@ namespace EnvelopeGenerator.Infrastructure.Contracts
{
public interface IEnvelopeReceiverRepository : ICRUDRepository<EnvelopeReceiver, (int Envelope, int Receiver)>
{
Task<IEnumerable<EnvelopeReceiver>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = false);
Task<IEnumerable<EnvelopeReceiver>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = true);
Task<IEnumerable<EnvelopeReceiver>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = false);
Task<IEnumerable<EnvelopeReceiver>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = true);
Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = false);
Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = false);
Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = true);
Task<int> CountAsync(string uuid, string signature);
Task<EnvelopeReceiver?> ReadByIdAsync(int envelopeId, int receiverId, bool readOnly = false);
Task<EnvelopeReceiver?> ReadByIdAsync(int envelopeId, int receiverId, bool readOnly = true);
Task<string?> ReadAccessCodeByIdAsync(int envelopeId, int receiverId, bool readOnly = false);
Task<string?> ReadAccessCodeByIdAsync(int envelopeId, int receiverId, bool readOnly = true);
Task<IEnumerable<EnvelopeReceiver>> ReadByUsernameAsync(string username, int? min_status = null, int? max_status = null, params int[] ignore_statuses);

View File

@ -11,7 +11,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
{
}
private IQueryable<EnvelopeReceiver> ReadWhere(string? uuid = null, string? signature = null, bool withEnvelope = false, bool withReceiver = false, bool readOnly = false)
private IQueryable<EnvelopeReceiver> ReadWhere(string? uuid = null, string? signature = null, bool withEnvelope = false, bool withReceiver = false, bool readOnly = true)
{
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet;
@ -32,33 +32,33 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
return query;
}
public async Task<IEnumerable<EnvelopeReceiver>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = false)
public async Task<IEnumerable<EnvelopeReceiver>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = true)
=> await ReadWhere(uuid: uuid, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly).ToListAsync();
public async Task<IEnumerable<EnvelopeReceiver>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = false)
public async Task<IEnumerable<EnvelopeReceiver>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = true)
=> await ReadWhere(signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly).ToListAsync();
public async Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = false)
public async Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true)
=> await ReadWhere(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly).FirstOrDefaultAsync();
public async Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = false)
public async Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = true)
=> await ReadWhere(uuid: uuid, signature: signature, readOnly: readOnly)
.Select(er => er.AccessCode)
.FirstOrDefaultAsync();
public async Task<int> CountAsync(string uuid, string signature) => await ReadWhere(uuid: uuid, signature: signature).CountAsync();
private IQueryable<EnvelopeReceiver> ReadById(int envelopeId, int receiverId, bool readOnly = false)
private IQueryable<EnvelopeReceiver> ReadById(int envelopeId, int receiverId, bool readOnly = true)
{
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet;
return query.Where(er => er.EnvelopeId == envelopeId && er.ReceiverId == receiverId);
}
public async Task<EnvelopeReceiver?> ReadByIdAsync(int envelopeId, int receiverId, bool readOnly = false)
public async Task<EnvelopeReceiver?> ReadByIdAsync(int envelopeId, int receiverId, bool readOnly = true)
=> await ReadById(envelopeId: envelopeId, receiverId: receiverId, readOnly: readOnly)
.FirstOrDefaultAsync();
public async Task<string?> ReadAccessCodeByIdAsync(int envelopeId, int receiverId, bool readOnly = false)
public async Task<string?> ReadAccessCodeByIdAsync(int envelopeId, int receiverId, bool readOnly = true)
=> await ReadById(envelopeId: envelopeId, receiverId: receiverId, readOnly: readOnly)
.Select(er => er.AccessCode)
.FirstOrDefaultAsync();