35 lines
1019 B
C#
35 lines
1019 B
C#
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<APIHeader?> FindHeader(string specific)
|
|
{
|
|
return await _context.APIHeader.FirstOrDefaultAsync(h => h.specific_id == specific);
|
|
}
|
|
|
|
public async Task<Version?> FindVersion(string type)
|
|
{
|
|
return await _context.Version.FirstOrDefaultAsync(v => v.os_type == (type =="I" ? "VO01" : "VO02"));
|
|
}
|
|
|
|
public async Task<RefreshToken?> FindRefreshToken(string refresh)
|
|
{
|
|
return await _context.RefreshToken.FirstOrDefaultAsync(r => r.refresh_token == refresh);
|
|
}
|
|
} |