This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package vkerr | |
import ( | |
"encoding/json" | |
"vkanalyze/libs/log" | |
"github.com/jackc/pgx" | |
) | |
const NotFound = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using Microsoft.EntityFrameworkCore; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.ComponentModel.DataAnnotations; | |
using System; | |
namespace Atrades.Accounts | |
{ | |
public class AccountsContext: DbContext | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task InvokeAsync(HttpContext httpContext) | |
{ | |
httpContext.Response.ContentType = "application/json"; | |
httpContext.Response.StatusCode = 200; | |
try | |
{ | |
await _next(httpContext); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Newtonsoft.Json; | |
namespace Atrades.WebAPI.ApiResponse | |
{ | |
public class Response | |
{ | |
private Response(bool error, int code, string message, object data = null) | |
{ | |
IsError = error; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountSchema | |
{ | |
public AccountSchema(Account.User user) | |
{ | |
Blocked = user.Blocked; | |
Confirmed = user.Confirmed; | |
Username = user.Name; | |
Email = user.Email; | |
PwdHash = "pwdHash"; | |
PwdSalt = "pwdSalt"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Cryptography; | |
using System; | |
using Microsoft.AspNetCore.Cryptography.KeyDerivation; | |
namespace Atrades.WebAPI.Account | |
{ | |
public class Password | |
{ | |
private Password(string hash, string salt) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountsContext: DbContext, DataModel.IUserStore | |
{ | |
public DbSet<UserSchema> AccountEntities { set; get; } | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<UserSchema>().ToTable("users"); | |
modelBuilder.Entity<UserSchema>().HasKey(a => a.Id); | |
modelBuilder.Entity<UserSchema>().HasAlternateKey(a => a.Email).HasName("AlternateKey_Email"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build | |
WORKDIR /app | |
COPY *.csproj ./ | |
RUN dotnet restore | |
COPY . ./ | |
RUN dotnet publish -c Release | |
# Add root certificates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.Hosting; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Serilog; | |
using Serilog.Filters; | |
using Serilog.Events; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Name | |
{ | |
public Name(Optional<string> fullName, Optional<string> firstName, Optional<string> lastName) | |
{ | |
FirstName = firstName; | |
LastName = lastName; | |
FullName = fullName; | |
} | |
public Optional<string> FullName {get; set;} |