using Back.Program.Common.Data; using Back.Program.Common.Model; using Back.Program.Models.Entities; using Back.Program.Repositories.V1.Interfaces; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Version = Back.Program.Models.Entities.Version; namespace Back.Program.Repositories.V1; public class AppRepository: IAppRepository { private readonly AppDbContext _context; public AppRepository(AppDbContext context) { _context = context; } public async Task FindHeader(string specific) { return await _context.APIHeader.FirstOrDefaultAsync(h => h.specific_id == specific); } public async Task FindVersion(string type) { return await _context.Version.FirstOrDefaultAsync(v => v.os_type == (type =="I" ? "VO01" : "VO02")); } public async Task FindRefreshToken(string refresh) { return await _context.RefreshToken.FirstOrDefaultAsync(r => r.refresh_token == refresh); } }