Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev project structure #3

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
442 changes: 221 additions & 221 deletions OFX/extrato1.ofx

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions _about/profile.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Meu perfil
-------

**Nome completo:**
**Data de nascimento:**
**LinkedIn:**
**Como nos conheceu:**
**Nome completo: Patrick Faustino Camello
**Data de nascimento: 02/02/1994
**LinkedIn: https://www.linkedin.com/in/patrick-faustino-camello-5997b2b6/
**Como nos conheceu: A Joseli Gomes encontrou meu perfil no LinkedIn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace DevelopersChallenge2.Domain
{
public class BankList : Entity
{
public DateTime DateStart { get; set; }
public DateTime DateEnd { get; set; }
public List<Transaction> Transactions { get; set; } = new List<Transaction>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace DevelopersChallenge2.Domain
{
public abstract class Entity
{
public int Id { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace DevelopersChallenge2.Domain
{
[Serializable, XmlRoot("OFX")]
public class OFX
{
[XmlElement]
public SIGNONMSGSRSV1 SIGNONMSGSRSV1 { get; set; }
[XmlElement]
public BANKMSGSRSV1 BANKMSGSRSV1 { get; set; }
}

[Serializable]
public class SIGNONMSGSRSV1
{
[XmlElement]
public SONRS SONRS { get; set; }
}

[Serializable]
public class SONRS
{
[XmlElement]
public STATUS STATUS { get; set; }
[XmlElement]
public string DTSERVER { get; set; }
[XmlElement]
public string LANGUAGE { get; set; }
}

[Serializable]
public class STATUS
{
[XmlElement]
public string CODE { get; set; }
[XmlElement]
public string SEVERITY { get; set; }
}

[Serializable]
public class BANKMSGSRSV1
{
[XmlElement]
public STMTTRNRS STMTTRNRS { get; set; }
}

[Serializable]
public class STMTTRNRS
{
[XmlElement]
public string TRNUID { get; set; }
[XmlElement]
public STATUS STATUS { get; set; }
[XmlElement]
public STMTRS STMTRS { get; set; }
}

[Serializable]
public class STMTRS
{
[XmlElement]
public string CURDEF { get; set; }
[XmlElement]
public BANKACCTFROM BANKACCTFROM { get; set; }
[XmlElement]
public BANKTRANLIST BANKTRANLIST { get; set; }
[XmlElement]
public LEDGERBAL LEDGERBAL { get; set; }
}

[Serializable]
public class BANKACCTFROM
{
[XmlElement]
public string BANKID { get; set; }
[XmlElement]
public string ACCTID { get; set; }
[XmlElement]
public string ACCTTYPE { get; set; }
}

[Serializable]
public class BANKTRANLIST : Entity
{
[XmlElement]
public string DTSTART { get; set; }
[XmlElement]
public string DTEND { get; set; }
[XmlArray]
[XmlArrayItem]
public List<STMTTRN> STMTTRN { get; set; } = new List<STMTTRN>();
}

[Serializable]
public class STMTTRN
{
[XmlElement]
public string TRNTYPE { get; set; }
[XmlElement]
public string DTPOSTED { get; set; }
[XmlElement]
public string TRNAMT { get; set; }
[XmlElement]
public string MEMO { get; set; }
}

[Serializable]
public class LEDGERBAL
{
[XmlElement]
public string BALAMT { get; set; }
[XmlElement]
public string DTASOF { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

namespace DevelopersChallenge2.Domain
{
public class Transaction : Entity
{
public string TransactionType { get; set; }
public DateTime DatePosted { get; set; }
public decimal TransactionAmount { get; set; }
public string Memo { get; set; }

public virtual int BankListId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DevelopersChallenge2.Domain\DevelopersChallenge2.Domain.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using DevelopersChallenge2.Domain;
using Microsoft.EntityFrameworkCore;

namespace DevelopersChallenge2.Repository
{
public class DevelopersChallenge2Context : DbContext
{
public DbSet<BankList> BankList { get; set; }
public DbSet<Transaction> Transaction { get; set; }

public DevelopersChallenge2Context(DbContextOptions<DevelopersChallenge2Context> options) : base(options) { }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using DevelopersChallenge2.Domain;

namespace DevelopersChallenge2.Repository.Interfaces
{
public interface IBankListRepository : IBaseRepository<BankList> {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using DevelopersChallenge2.Domain;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace DevelopersChallenge2.Repository.Interfaces
{
public interface IBaseRepository<T> where T: Entity
{
Task<IList<T>> Get();
Task<IList<T>> GetByCondition(Expression<Func<T, bool>> where);
Task Post(T entity);
Task Put(T entity);
Task Delete(int id);
Task DeleteList(List<T> entities);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using DevelopersChallenge2.Domain;

namespace DevelopersChallenge2.Repository.Interfaces
{
public interface ITransactionRepository : IBaseRepository<Transaction> {}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace DevelopersChallenge2.Repository.Migrations
{
public partial class FirstMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BankList",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
DateStart = table.Column<DateTime>(nullable: false),
DateEnd = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BankList", x => x.Id);
});

migrationBuilder.CreateTable(
name: "Transaction",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
TransactionType = table.Column<string>(nullable: true),
DatePosted = table.Column<DateTime>(nullable: false),
TransactionAmount = table.Column<decimal>(nullable: false),
Memo = table.Column<string>(nullable: true),
IdBankList = table.Column<int>(nullable: false),
BankListId = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Transaction", x => x.Id);
table.ForeignKey(
name: "FK_Transaction_BankList_BankListId",
column: x => x.BankListId,
principalTable: "BankList",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.CreateIndex(
name: "IX_Transaction_BankListId",
table: "Transaction",
column: "BankListId");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Transaction");

migrationBuilder.DropTable(
name: "BankList");
}
}
}
Loading