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
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 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; | |
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 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.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
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
package erabbit | |
import ( | |
"sync" | |
"vkanalyze/libs/config" | |
"vkanalyze/libs/log" | |
"vkanalyze/libs/vkerr" | |
"github.com/streadway/amqp" | |
) |
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 erabbit | |
import ( | |
"sync" | |
"vkanalyze/libs/config" | |
"vkanalyze/libs/log" | |
"vkanalyze/libs/vkerr" | |
"github.com/streadway/amqp" | |
) |
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
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 |