Skip to content

Instantly share code, notes, and snippets.

View 2garryn's full-sized avatar

Artem Golovinsky 2garryn

  • Russia, Saint-Petersburg
View GitHub Profile
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");
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 AccountSchema
{
public AccountSchema(Account.User user)
{
Blocked = user.Blocked;
Confirmed = user.Confirmed;
Username = user.Name;
Email = user.Email;
PwdHash = "pwdHash";
PwdSalt = "pwdSalt";
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 async Task InvokeAsync(HttpContext httpContext)
{
httpContext.Response.ContentType = "application/json";
httpContext.Response.StatusCode = 200;
try
{
await _next(httpContext);
}
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
{
package vkerr
import (
"encoding/json"
"vkanalyze/libs/log"
"github.com/jackc/pgx"
)
const NotFound = 100
package erabbit
import (
"sync"
"vkanalyze/libs/config"
"vkanalyze/libs/log"
"vkanalyze/libs/vkerr"
"github.com/streadway/amqp"
)
package erabbit
import (
"sync"
"vkanalyze/libs/config"
"vkanalyze/libs/log"
"vkanalyze/libs/vkerr"
"github.com/streadway/amqp"
)
func message_new() (hnd eventHandler, name string, stmt string) {
type newMessage struct {
Date json.Number `json:"date"`
UserId json.Number `json:"user_id"`
}
table := config.GetDbConfig().Database + ".event_message_new"
name = "message_new"
stmt = "insert into " + table + "(groupid,timestamp,sender,unique_key,amount) VALUES($1,$2,$3,$4,1) on conflict(unique_key) DO UPDATE SET amount=event_message_new.amount + 1;"
hnd = func (groupid string, object json.RawMessage, inserter database.EventInserter) error {
var nm newMessage