Compare commits

...

4 Commits

486 changed files with 897 additions and 25890 deletions

View File

@ -10,7 +10,7 @@
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<SpaProxyServerUrl>https://localhost:44423</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand>
<RootNamespace>active_allocator</RootNamespace>
<RootNamespace>ActiveAllocator.API</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

View File

@ -1,4 +1,4 @@
namespace active_allocator.Authorization;
namespace ActiveAllocator.API.Authorization;
[AttributeUsage(AttributeTargets.Method)]
public class AllowAnonymousAttribute : Attribute

View File

@ -1,8 +1,8 @@
namespace active_allocator.Authorization;
namespace ActiveAllocator.API.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using active_allocator.Entities;
using ActiveAllocator.API.Entities;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class AuthorizeAttribute : Attribute, IAuthorizationFilter

View File

@ -1,6 +1,6 @@
namespace active_allocator.Authorization;
namespace ActiveAllocator.API.Authorization;
using active_allocator.Services;
using ActiveAllocator.API.Services;
public class JwtMiddleware
{

View File

@ -1,12 +1,12 @@
namespace active_allocator.Authorization;
namespace ActiveAllocator.API.Authorization;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using active_allocator.Entities;
using active_allocator.Helpers;
using ActiveAllocator.API.Entities;
using ActiveAllocator.API.Helpers;
public interface IJwtUtils
{

View File

@ -1,11 +1,11 @@
{
"name": "active_allocator",
"name": "ActiveAllocator.API",
"version": "0.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "active_allocator",
"name": "ActiveAllocator.API",
"version": "0.1.0",
"dependencies": {
"bootstrap": "^5.2.3",

View File

@ -1,5 +1,5 @@
{
"name": "active_allocator",
"name": "ActiveAllocator.API",
"version": "0.1.0",
"private": true,
"dependencies": {

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -20,7 +20,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>active_allocator</title>
<title>ActiveAllocator.API</title>
</head>
<body>
<noscript>

View File

@ -1,6 +1,6 @@
{
"short_name": "active_allocator",
"name": "active_allocator",
"short_name": "ActiveAllocator.API",
"name": "ActiveAllocator.API",
"icons": [
{
"src": "favicon.ico",

View File

@ -26,7 +26,7 @@ export class NavMenu extends Component {
return (
<header>
<Navbar className="navbar-expand-sm navbar-toggleable-sm ng-white border-bottom box-shadow mb-3" container light>
<NavbarBrand tag={Link} to="/">active_allocator</NavbarBrand>
<NavbarBrand tag={Link} to="/">ActiveAllocator.API</NavbarBrand>
<NavbarToggler onClick={this.toggleNavbar} className="mr-2" />
<Collapse className="d-sm-inline-flex flex-sm-row-reverse" isOpen={!this.state.collapsed} navbar>
<ul className="navbar-nav flex-grow">

View File

@ -1,4 +1,4 @@
namespace active_allocator.Configs;
namespace ActiveAllocator.API.Configs;
public class EnvelopeFundConfig
{

View File

@ -1,14 +1,14 @@
namespace active_allocator.Controllers;
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using active_allocator.Models.Accounts;
using active_allocator.Services;
using active_allocator.Authorization;
using active_allocator.Helpers;
using ActiveAllocator.API.Models.Accounts;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Authorization;
using ActiveAllocator.API.Helpers;
using System.Collections.Generic;
using active_allocator.Entities;
using ActiveAllocator.API.Entities;
[Authorize]
[ApiController]

View File

@ -1,14 +1,14 @@
namespace active_allocator.Controllers;
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using active_allocator.Models.Autoclass;
using active_allocator.Services;
using active_allocator.Authorization;
using active_allocator.Helpers;
using ActiveAllocator.API.Models.Autoclass;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Authorization;
using ActiveAllocator.API.Helpers;
using System.Collections.Generic;
using active_allocator.Entities;
using ActiveAllocator.API.Entities;
[Authorize]
[ApiController]

View File

@ -1,12 +1,12 @@
namespace active_allocator.Controllers;
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using active_allocator.Models.CurrencyType;
using active_allocator.Services;
using active_allocator.Authorization;
using active_allocator.Helpers;
using ActiveAllocator.API.Models.CurrencyType;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Authorization;
using ActiveAllocator.API.Helpers;
[Authorize]
[ApiController]

View File

@ -1,14 +1,14 @@
namespace active_allocator.Controllers;
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using active_allocator.Models.Envelopes;
using active_allocator.Services;
using active_allocator.Authorization;
using active_allocator.Helpers;
using ActiveAllocator.API.Models.Envelopes;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Authorization;
using ActiveAllocator.API.Helpers;
using System.Collections.Generic;
using active_allocator.Entities;
using ActiveAllocator.API.Entities;
[Authorize]
[ApiController]

View File

@ -1,14 +1,14 @@
namespace active_allocator.Controllers;
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using active_allocator.Models.Transactions;
using active_allocator.Services;
using active_allocator.Authorization;
using active_allocator.Helpers;
using ActiveAllocator.API.Models.Transactions;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Authorization;
using ActiveAllocator.API.Helpers;
using System.Runtime.InteropServices;
using active_allocator.Entities;
using ActiveAllocator.API.Entities;
using System.Collections.Generic;
[Authorize]

View File

@ -1,12 +1,12 @@
namespace active_allocator.Controllers;
namespace ActiveAllocator.API.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using active_allocator.Models.Users;
using active_allocator.Services;
using active_allocator.Authorization;
using active_allocator.Helpers;
using ActiveAllocator.API.Models.Users;
using ActiveAllocator.API.Services;
using ActiveAllocator.API.Authorization;
using ActiveAllocator.API.Helpers;
using System;
[Authorize]

View File

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class Account
{

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace ActiveAllocator.API.Entities;
public class AccountHistorical
{
//public int Id { get; set; }
public Account Account { get; set; }
public int LookBack { get; set; }
public Statistic Income { get; set; } = null;
public Statistic Credit { get; set; } = null;
public Statistic Debit { get; set; } = null;
}

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class AutoclassChange
{

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class AutoclassExpression
{

View File

@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class AutoclassRule
{

View File

@ -1,7 +1,7 @@
using System.Data;
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class CurrencyType
{

View File

@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class Envelope
{

View File

@ -1,7 +1,7 @@
using System.Data;
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class EnvelopeFundingMethod
{

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace ActiveAllocator.API.Entities;
public class EnvelopeHistorical
{
//public int Id { get; set; }
public Envelope Envelope { get; set; }
public int LookBack { get; set; }
public decimal? EnvelopeFunding { get; set; } = null;
public Statistic Credit { get; set; } = null;
public Statistic Debit { get; set; } = null;
}

View File

@ -1,8 +1,8 @@
using System.Data;
using System.Text.Json.Serialization;
using active_allocator.Enums;
using ActiveAllocator.API.Enums;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class Operation
{

View File

@ -1,4 +1,4 @@
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public enum Role
{

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace ActiveAllocator.API.Entities;
public class Statistic
{
//public int Id { get; set; }
public Dictionary<DateTime, decimal> Values { get; set; } = null;
public decimal? Median { get; set; } = null;
public decimal? Mean { get; set; } = null;
public decimal? High { get; set; } = null;
public decimal? Low { get; set; } = null;
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using active_allocator.Services;
using ActiveAllocator.API.Services;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class Transaction
{

View File

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace active_allocator.Entities;
namespace ActiveAllocator.API.Entities;
public class User
{

View File

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace active_allocator.Enums;
namespace ActiveAllocator.API.Enums;
public enum HistoricStatistic
{

View File

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace active_allocator.Enums;
namespace ActiveAllocator.API.Enums;
public enum OperationMode
{

View File

@ -1,4 +1,4 @@
namespace active_allocator.Helpers;
namespace ActiveAllocator.API.Helpers;
using System.Globalization;

View File

@ -1,4 +1,4 @@
namespace active_allocator.Helpers;
namespace ActiveAllocator.API.Helpers;
public class AppSettings
{

View File

@ -1,15 +1,15 @@
namespace active_allocator.Helpers;
namespace ActiveAllocator.API.Helpers;
using AutoMapper;
using active_allocator.Entities;
using active_allocator.Models.Users;
using active_allocator.Models.Accounts;
using active_allocator.Models.Envelopes;
using active_allocator.Models.CurrencyType;
using active_allocator.Services;
using ActiveAllocator.API.Entities;
using ActiveAllocator.API.Models.Users;
using ActiveAllocator.API.Models.Accounts;
using ActiveAllocator.API.Models.Envelopes;
using ActiveAllocator.API.Models.CurrencyType;
using ActiveAllocator.API.Services;
using System.Runtime.Serialization;
using active_allocator.Models.Transactions;
using active_allocator.Models.Autoclass;
using ActiveAllocator.API.Models.Transactions;
using ActiveAllocator.API.Models.Autoclass;
public class AutoMapperProfile : Profile
{

View File

@ -1,13 +1,14 @@
namespace active_allocator.Helpers;
namespace ActiveAllocator.API.Helpers;
using Microsoft.EntityFrameworkCore;
using active_allocator.Entities;
using ActiveAllocator.API.Entities;
using System.Diagnostics;
using System;
using System.Collections.Generic;
using Internal;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
public class DataContext : DbContext
{
@ -109,14 +110,16 @@ public class DataContext : DbContext
_logger.LogInformation($"Recalculating virtual balance for account '{account.Name}' (id={accountId}).");
decimal virtualBalance = account.Balance;
// 2nd half of CHECK BELOW IS TEMPORARY
if (hist.MedianIncome.HasValue)
{
if (hist.MedianIncome.Value == 0 && hist.MeanIncome.HasValue)
hist.MedianIncome = hist.MeanIncome.Value;
_logger.LogInformation($"Using Median Income Value of {hist.MedianIncome.Value}...");
virtualBalance = hist.MedianIncome.Value;
// Make this configurable?
// // 2nd half of CHECK BELOW IS TEMPORARY
if (hist.Income != null && hist.Income.Median.HasValue)
{
/*if (hist.Income.Median.Value == 0 && hist.Income.Mean.HasValue)
hist.Income.Median = hist.Income.Mean.Value;*/
_logger.LogInformation($"Using Median Income Value of {hist.Income.Median.Value}...");
virtualBalance = hist.Income.Median.Value;
}
// Determine Virtual Balance
@ -159,15 +162,25 @@ public class DataContext : DbContext
.Where(t => t.Date >= lookBackDate.ToUniversalTime() && t.Date <= lastOfLastMonth.ToUniversalTime())
.ToList();
decimal sumExpend = 0;
// Sum variables
decimal sumDebit = 0;
decimal sumCredit = 0;
decimal sumIncome = 0;
decimal highExpend = 0;
decimal lowExpend = 100000000;
// High variables
decimal highDebit = 0;
decimal highCredit = 0;
decimal highIncome = 0;
// Low variables
decimal lowDebit = 100000000;
decimal lowCredit = 100000000;
decimal lowIncome = 100000000;
Dictionary<DateTime, decimal> statsExpend = new Dictionary<DateTime, decimal>();
Dictionary<DateTime, decimal> statsIncome = new Dictionary<DateTime, decimal>();
// Values variables
Dictionary<DateTime, decimal> valuesDebit = new Dictionary<DateTime, decimal>();
Dictionary<DateTime, decimal> valuesCredit = new Dictionary<DateTime, decimal>();
Dictionary<DateTime, decimal> valuesIncome = new Dictionary<DateTime, decimal>();
bool monthHasData = false;
@ -176,41 +189,67 @@ public class DataContext : DbContext
DateTime currentLookBackMonth = lastOfLastMonth.AddMonths(-i);
List<Transaction> monthTransactions = this.GetTransactionsFromMonth(currentLookBackMonth, transactions);
decimal monthlySumExpend = 0;
decimal monthlySumDebit = 0;
decimal monthlySumCredit = 0;
decimal monthlySumIncome = 0;
foreach (Transaction tran in monthTransactions)
{
monthHasData = true;
if (tran.CreditAccount != null && tran.CreditAccount.Id == id)
monthlySumIncome += tran.Amount;
{
monthlySumCredit += tran.Amount;
// Place holder - Income Condition goes here
if (false)
monthlySumIncome += tran.Amount;
}
else
monthlySumExpend += tran.Amount;
monthlySumDebit += tran.Amount;
}
sumExpend += monthlySumExpend;
sumDebit += monthlySumDebit;
sumCredit += monthlySumCredit;
sumIncome += monthlySumIncome;
highExpend = i == 0 || monthlySumExpend > highExpend ? monthlySumExpend : highExpend;
highDebit = i == 0 || monthlySumDebit > highDebit ? monthlySumDebit : highDebit;
highCredit = i == 0 || monthlySumCredit > highCredit ? monthlySumCredit : highCredit;
highIncome = i == 0 || monthlySumIncome > highIncome ? monthlySumIncome : highIncome;
lowExpend = i == 0 || monthlySumExpend < lowExpend ? monthlySumExpend : lowExpend;
lowDebit = i == 0 || monthlySumDebit < lowDebit ? monthlySumDebit : lowDebit;
lowCredit = i == 0 || monthlySumCredit < lowCredit ? monthlySumCredit : lowCredit;
lowIncome = i == 0 || monthlySumIncome < lowIncome ? monthlySumIncome : lowIncome;
statsExpend.Add(currentLookBackMonth, monthlySumExpend);
statsIncome.Add(currentLookBackMonth, monthlySumIncome);
valuesDebit.Add(currentLookBackMonth, monthlySumDebit);
valuesCredit.Add(currentLookBackMonth, monthlySumCredit);
valuesIncome.Add(currentLookBackMonth, monthlySumIncome);
}
if (monthHasData == false)
return hist;
hist.MedianExpendeture = HistoricalMedian(statsExpend);
hist.MedianIncome = HistoricalMedian(statsIncome);
hist.MeanExpendeture = sumExpend / (decimal)lookBack;
hist.MeanIncome = sumIncome / (decimal)lookBack;
hist.HighExpendeture = highExpend;
hist.HighIncome = highIncome;
hist.LowExpendeture = lowExpend;
hist.LowIncome = lowIncome;
hist.Debit = new Statistic() {
Median = HistoricalMedian(valuesDebit),
Mean = sumDebit / (decimal)lookBack,
High = highDebit,
Low = lowDebit,
};
hist.Credit = new Statistic() {
Median = HistoricalMedian(valuesCredit),
Mean = sumCredit / (decimal)lookBack,
High = highCredit,
Low = lowCredit,
};
hist.Income = new Statistic() {
Median = HistoricalMedian(valuesIncome),
Mean = sumIncome / (decimal)lookBack,
High = highIncome,
Low = lowIncome,
};
return hist;
}
@ -298,14 +337,19 @@ public class DataContext : DbContext
if (monthHasData == false)
return hist;
hist.MedianExpendeture = HistoricalMedian(statsExpend);
hist.MedianIncome = HistoricalMedian(statsIncome);
hist.MeanExpendeture = sumExpend / (decimal)lookBack;
hist.MeanIncome = sumIncome / (decimal)lookBack;
hist.HighExpendeture = highExpend;
hist.HighIncome = highIncome;
hist.LowExpendeture = lowExpend;
hist.LowIncome = lowIncome;
hist.Credit = new Statistic() {
Median = HistoricalMedian(statsIncome),
Mean = sumIncome / (decimal)lookBack,
High = highIncome,
Low = lowIncome,
};
hist.Debit = new Statistic() {
Median = HistoricalMedian(statsExpend),
Mean = sumExpend / (decimal)lookBack,
High = highExpend,
Low = lowExpend,
};
return hist;
}

View File

@ -1,4 +1,4 @@
namespace active_allocator.Helpers;
namespace ActiveAllocator.API.Helpers;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

View File

@ -4,11 +4,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using active_allocator.Helpers;
using ActiveAllocator.API.Helpers;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20231117033912_InitialCreate")]
@ -24,7 +24,7 @@ namespace active_allocator.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()

View File

@ -3,7 +3,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration

View File

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using active_allocator.Helpers;
using ActiveAllocator.API.Helpers;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20231201042238_AccountsAllocsOperations")]
@ -25,7 +25,7 @@ namespace active_allocator.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -68,7 +68,7 @@ namespace active_allocator.Migrations
b.ToTable("Accounts");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -108,7 +108,7 @@ namespace active_allocator.Migrations
b.ToTable("Allocs");
});
modelBuilder.Entity("active_allocator.Entities.CurrencyType", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.CurrencyType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -132,7 +132,7 @@ namespace active_allocator.Migrations
b.ToTable("CurrencyTypes");
});
modelBuilder.Entity("active_allocator.Entities.Operation", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Operation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -177,7 +177,7 @@ namespace active_allocator.Migrations
b.ToTable("Operations");
});
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -213,15 +213,15 @@ namespace active_allocator.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.HasOne("active_allocator.Entities.CurrencyType", "Currency")
b.HasOne("ActiveAllocator.API.Entities.CurrencyType", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.User", "Owner")
b.HasOne("ActiveAllocator.API.Entities.User", "Owner")
.WithMany("Accounts")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
@ -232,9 +232,9 @@ namespace active_allocator.Migrations
b.Navigation("Owner");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.HasOne("active_allocator.Entities.Account", "Account")
b.HasOne("ActiveAllocator.API.Entities.Account", "Account")
.WithMany("Allocs")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
@ -243,24 +243,24 @@ namespace active_allocator.Migrations
b.Navigation("Account");
});
modelBuilder.Entity("active_allocator.Entities.Operation", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Operation", b =>
{
b.HasOne("active_allocator.Entities.Alloc", null)
b.HasOne("ActiveAllocator.API.Entities.Alloc", null)
.WithMany("Operations")
.HasForeignKey("AllocId");
});
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.Navigation("Allocs");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.Navigation("Operations");
});
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Navigation("Accounts");
});

View File

@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
/// <inheritdoc />
public partial class AccountsAllocsOperations : Migration

View File

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using active_allocator.Helpers;
using ActiveAllocator.API.Helpers;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20231219215509_AddedTransactionEntity")]
@ -25,7 +25,7 @@ namespace active_allocator.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -68,7 +68,7 @@ namespace active_allocator.Migrations
b.ToTable("Accounts");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -108,7 +108,7 @@ namespace active_allocator.Migrations
b.ToTable("Allocs");
});
modelBuilder.Entity("active_allocator.Entities.CurrencyType", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.CurrencyType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -132,7 +132,7 @@ namespace active_allocator.Migrations
b.ToTable("CurrencyTypes");
});
modelBuilder.Entity("active_allocator.Entities.InnerTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.InnerTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -194,7 +194,7 @@ namespace active_allocator.Migrations
b.ToTable("InnerTransactions");
});
modelBuilder.Entity("active_allocator.Entities.Operation", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Operation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -239,7 +239,7 @@ namespace active_allocator.Migrations
b.ToTable("Operations");
});
modelBuilder.Entity("active_allocator.Entities.OuterTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.OuterTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -271,7 +271,7 @@ namespace active_allocator.Migrations
b.ToTable("OuterTransactions");
});
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -307,15 +307,15 @@ namespace active_allocator.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.HasOne("active_allocator.Entities.CurrencyType", "Currency")
b.HasOne("ActiveAllocator.API.Entities.CurrencyType", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.User", "Owner")
b.HasOne("ActiveAllocator.API.Entities.User", "Owner")
.WithMany("Accounts")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
@ -326,9 +326,9 @@ namespace active_allocator.Migrations
b.Navigation("Owner");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.HasOne("active_allocator.Entities.Account", "Account")
b.HasOne("ActiveAllocator.API.Entities.Account", "Account")
.WithMany("Allocs")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
@ -337,31 +337,31 @@ namespace active_allocator.Migrations
b.Navigation("Account");
});
modelBuilder.Entity("active_allocator.Entities.InnerTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.InnerTransaction", b =>
{
b.HasOne("active_allocator.Entities.Account", "CreditAccount")
b.HasOne("ActiveAllocator.API.Entities.Account", "CreditAccount")
.WithMany()
.HasForeignKey("CreditAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.CurrencyType", "CurrencyType")
b.HasOne("ActiveAllocator.API.Entities.CurrencyType", "CurrencyType")
.WithMany()
.HasForeignKey("CurrencyTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.Account", "DebitAccount")
b.HasOne("ActiveAllocator.API.Entities.Account", "DebitAccount")
.WithMany()
.HasForeignKey("DebitAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.InnerTransaction", null)
b.HasOne("ActiveAllocator.API.Entities.InnerTransaction", null)
.WithMany("Transactions")
.HasForeignKey("InnerTransactionId");
b.HasOne("active_allocator.Entities.OuterTransaction", null)
b.HasOne("ActiveAllocator.API.Entities.OuterTransaction", null)
.WithMany("Transactions")
.HasForeignKey("OuterTransactionId");
@ -372,16 +372,16 @@ namespace active_allocator.Migrations
b.Navigation("DebitAccount");
});
modelBuilder.Entity("active_allocator.Entities.Operation", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Operation", b =>
{
b.HasOne("active_allocator.Entities.Alloc", null)
b.HasOne("ActiveAllocator.API.Entities.Alloc", null)
.WithMany("Operations")
.HasForeignKey("AllocId");
});
modelBuilder.Entity("active_allocator.Entities.OuterTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.OuterTransaction", b =>
{
b.HasOne("active_allocator.Entities.User", "Owner")
b.HasOne("ActiveAllocator.API.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
@ -390,27 +390,27 @@ namespace active_allocator.Migrations
b.Navigation("Owner");
});
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.Navigation("Allocs");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.Navigation("Operations");
});
modelBuilder.Entity("active_allocator.Entities.InnerTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.InnerTransaction", b =>
{
b.Navigation("Transactions");
});
modelBuilder.Entity("active_allocator.Entities.OuterTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.OuterTransaction", b =>
{
b.Navigation("Transactions");
});
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Navigation("Accounts");
});

View File

@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
/// <inheritdoc />
public partial class AddedTransactionEntity : Migration

View File

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using active_allocator.Helpers;
using ActiveAllocator.API.Helpers;
#nullable disable
namespace active_allocator.Migrations
namespace ActiveAllocator.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20231221130142_ModifiedTranscationEntity")]
@ -25,7 +25,7 @@ namespace active_allocator.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -68,7 +68,7 @@ namespace active_allocator.Migrations
b.ToTable("Accounts");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -108,7 +108,7 @@ namespace active_allocator.Migrations
b.ToTable("Allocs");
});
modelBuilder.Entity("active_allocator.Entities.CurrencyType", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.CurrencyType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -132,7 +132,7 @@ namespace active_allocator.Migrations
b.ToTable("CurrencyTypes");
});
modelBuilder.Entity("active_allocator.Entities.InnerTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.InnerTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -179,7 +179,7 @@ namespace active_allocator.Migrations
b.ToTable("InnerTransactions");
});
modelBuilder.Entity("active_allocator.Entities.Operation", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Operation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -224,7 +224,7 @@ namespace active_allocator.Migrations
b.ToTable("Operations");
});
modelBuilder.Entity("active_allocator.Entities.OuterTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.OuterTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -259,7 +259,7 @@ namespace active_allocator.Migrations
b.ToTable("OuterTransactions");
});
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -295,15 +295,15 @@ namespace active_allocator.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.HasOne("active_allocator.Entities.CurrencyType", "Currency")
b.HasOne("ActiveAllocator.API.Entities.CurrencyType", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.User", "Owner")
b.HasOne("ActiveAllocator.API.Entities.User", "Owner")
.WithMany("Accounts")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
@ -314,9 +314,9 @@ namespace active_allocator.Migrations
b.Navigation("Owner");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.HasOne("active_allocator.Entities.Account", "Account")
b.HasOne("ActiveAllocator.API.Entities.Account", "Account")
.WithMany("Allocs")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
@ -325,27 +325,27 @@ namespace active_allocator.Migrations
b.Navigation("Account");
});
modelBuilder.Entity("active_allocator.Entities.InnerTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.InnerTransaction", b =>
{
b.HasOne("active_allocator.Entities.Account", "CreditAccount")
b.HasOne("ActiveAllocator.API.Entities.Account", "CreditAccount")
.WithMany()
.HasForeignKey("CreditAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.CurrencyType", "CurrencyType")
b.HasOne("ActiveAllocator.API.Entities.CurrencyType", "CurrencyType")
.WithMany()
.HasForeignKey("CurrencyTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.Account", "DebitAccount")
b.HasOne("ActiveAllocator.API.Entities.Account", "DebitAccount")
.WithMany()
.HasForeignKey("DebitAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("active_allocator.Entities.OuterTransaction", null)
b.HasOne("ActiveAllocator.API.Entities.OuterTransaction", null)
.WithMany("Transactions")
.HasForeignKey("OuterTransactionId");
@ -356,16 +356,16 @@ namespace active_allocator.Migrations
b.Navigation("DebitAccount");
});
modelBuilder.Entity("active_allocator.Entities.Operation", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Operation", b =>
{
b.HasOne("active_allocator.Entities.Alloc", null)
b.HasOne("ActiveAllocator.API.Entities.Alloc", null)
.WithMany("Operations")
.HasForeignKey("AllocId");
});
modelBuilder.Entity("active_allocator.Entities.OuterTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.OuterTransaction", b =>
{
b.HasOne("active_allocator.Entities.User", "Owner")
b.HasOne("ActiveAllocator.API.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
@ -374,22 +374,22 @@ namespace active_allocator.Migrations
b.Navigation("Owner");
});
modelBuilder.Entity("active_allocator.Entities.Account", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Account", b =>
{
b.Navigation("Allocs");
});
modelBuilder.Entity("active_allocator.Entities.Alloc", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.Alloc", b =>
{
b.Navigation("Operations");
});
modelBuilder.Entity("active_allocator.Entities.OuterTransaction", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.OuterTransaction", b =>
{
b.Navigation("Transactions");
});
modelBuilder.Entity("active_allocator.Entities.User", b =>
modelBuilder.Entity("ActiveAllocator.API.Entities.User", b =>
{
b.Navigation("Accounts");
});

Some files were not shown because too many files have changed in this diff Show More