Skip to content

Instantly share code, notes, and snippets.

View 2garryn's full-sized avatar

Artem Golovinsky 2garryn

  • Russia, Saint-Petersburg
View GitHub Profile
package vkerr
import (
"encoding/json"
"vkanalyze/libs/log"
"github.com/jackc/pgx"
)
const NotFound = 100
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
{
public async Task InvokeAsync(HttpContext httpContext)
{
httpContext.Response.ContentType = "application/json";
httpContext.Response.StatusCode = 200;
try
{
await _next(httpContext);
}
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;
public class AccountSchema
{
public AccountSchema(Account.User user)
{
Blocked = user.Blocked;
Confirmed = user.Confirmed;
Username = user.Name;
Email = user.Email;
PwdHash = "pwdHash";
PwdSalt = "pwdSalt";
using System.Security.Cryptography;
using System;
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
namespace Atrades.WebAPI.Account
{
public class Password
{
private Password(string hash, string salt)
{
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");
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
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;
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;}