summaryrefslogtreecommitdiff
path: root/src/marlin.web/Models/DatabaseSourceSecretStore.cs
blob: b4ca61f7c8fdec5e946a4bf4cc429a6cb58e8f84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace marlin.web.Models;

using core.models;
using Data;
using Microsoft.EntityFrameworkCore;

public class DatabaseSourceSecretStore(ApplicationDbContext dbContext) : ISourceSecretStore
{
    public async Task<ISecret?> GetAsync(Guid id, CancellationToken ct)
    {
        return await dbContext.Secrets
            .FirstOrDefaultAsync(x => x.Id == id, cancellationToken: ct);
    }
}

public class VersionControlSecret : ISecret
{
    public Guid Id { get; set; }
    
    public Guid SourceId { get; set; }
    public VersionControlSource Source { get; set; }
    
    public bool MayReveal { get; set; }
    public string? Kind { get; set; }
    public string Label { get; set; }
    public Dictionary<string, string> Content { get; set; }
}