Coder Social home page Coder Social logo

code4romania / anabi-gestiune-api Goto Github PK

View Code? Open in Web Editor NEW
9.0 19.0 7.0 20.92 MB

API-ul portalului de gestiune pentru ANABI

Home Page: https://code4.ro/ro/apps/anabi/

License: Mozilla Public License 2.0

C# 97.02% CSS 0.15% JavaScript 0.01% Dockerfile 0.06% TypeScript 2.75%
civic-tech civic-hacking code4ro anabi transparency

anabi-gestiune-api's Introduction

ANABI Platform - API

GitHub contributors GitHub last commit License: MPL 2.0

Code 4 Romania is currently developing a platform centralizing all criminal assets seized in Romania, their net worth and location for the National Agency for the Management of Seized Assets. Goods are often seized as part of corruption-related or other criminal activities. Romania does not have an manageable digital inventory of every confiscated good, therefore the agency is struggling with managing the confiscation process, allocating space in warehouses throughout the country, protecting them, evaluating them and finally reselling or repurposing those goods. The goal is to map all seized assets so that, first and foremost, citizens know what is going on with these assets. Secondly, the National Agency will also use the platform to administer and re-direct these assets. The platform will therefore also make the process of administering seized assets more transparent. The Agency has a plan and process in place for re-utilizing or re-selling goods. The money made from re-selling goods will be turned into a financing grant for NGOs, and other goods (such as buildings) will be also given as working space for non-profits, for example.

Contributing | Built with | Repos and projects | Deployment | Feedback | License | About Code4Ro

Contributing

This project is built by amazing volunteers and you can be one of them! Here's a list of ways in which you can contribute to this project.

Built With

.Net Core 2.2 ^

SQL Server Express

Visual Studio Community Edition (Free/Multiplatform)

Swagger

Deployment

  1. install .NetCore (Open Source/Free/Multiplatform) from here

  2. run the following command from the console, from inside the Anabi folder:

    anabi-gestiune-api.git\Anabi> dotnet restore
  3. run the following command from the console, from inside the Anabi folder:

    anabi-gestiune-api.git\Anabi> dotnet run
  4. browse to indicated address: e.g. http://localhost:5000/swagger

Repos and projects

Related projects:

Feedback

  • Request a new feature on GitHub.
  • Vote for popular feature requests.
  • File a bug in GitHub Issues.
  • Email us with other feedback [email protected]

License

This project is licensed under the MPL 2.0 License - see the LICENSE file for details

About Code4Ro

Started in 2016, Code for Romania is a civic tech NGO, official member of the Code for All network. We have a community of over 500 volunteers (developers, ux/ui, communications, data scientists, graphic designers, devops, it security and more) who work pro-bono for developing digital solutions to solve social problems. #techforsocialgood. If you want to learn more details about our projects visit our site or if you want to talk to one of our staff members, please e-mail us at [email protected].

Last, but not least, we rely on donations to ensure the infrastructure, logistics and management of our community that is widely spread across 11 timezones, coding for social change to make Romania and the world a better place. If you want to support us, you can do it here.

anabi-gestiune-api's People

Contributors

andreiio avatar aniri avatar bioan avatar bvizureanu avatar cosminpopescu14 avatar deviad avatar dhont avatar florianclaudiug avatar lucianu avatar puiu avatar radu-ungureanu avatar raducstefanescu avatar sebastianboca avatar stefan-oproiu avatar victoriuonas avatar vlad2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anabi-gestiune-api's Issues

[ANABI feedback] Adaugare organ judiciar competent la bun

Cand se introduce un bun nou, este nevoie de informatie legata de organul judiciar competent care reprezinta sursa dosarului de care apartine bunul.
Informatia este un parchet/instanta judecatoreasca si parchetele de pe langa instanta.

[ANABI feedback] Import hotarari judecatoresti

Import de hotarari judecatoresti din fisier de tip excel.
Hotararile judecatoresti se importa pe baza unui cap de tabel.
Importul unei hotarari judecatoresti genereaza un bun Confiscat.

Un bun nou adaugat nu poate fi vizualizat

Bug description
Adaugarea unui nou bun functioneaza, dar la vizualizarea unui bun nou adaugat se primeste un status 500 Internal server error cu mesajul:

{"Message":"Nullable object must have a value.","Errors":["Nullable object must have a value."]}

Step to reproduce it

  • introducere bun nou
  • click pe bun nou pentru vizualizare
  • vizualizare bun nou

Expected behavior
Dupa adaugarea unui bun nou un utilizator ar tb sa poata sa vizualizeze resursa introdusa, fara erori

Additional info
Screenshot 2019-07-23 at 19 50 56
Screenshot 2019-07-23 at 19 51 14

Initialize database script fails

When using an empty database - the initialize method fails with the following error message.

Steps to reproduce:

  1. Change the AnabiDatabase connection string to point to an empty sql server database.
  2. Run the Anabi project.
An error occurred while starting the application.

InvalidOperationException: The association between entity types 'CategoryDb' and 'StorageSpaceDb' has been severed but the foreign key for this relationship cannot be set to null. If the dependent entity should be deleted, then setup the relationship to use cascade deletes.

Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.HandleConceptualNulls()


InvalidOperationException: The association between entity types 'CategoryDb' and 'StorageSpaceDb' has been severed but the foreign key for this relationship cannot be set to null. If the dependent entity should be deleted, then setup the relationship to use cascade deletes.

Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.HandleConceptualNulls()


Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.GetEntriesToSave()


Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(bool acceptAllChangesOnSuccess)


Microsoft.EntityFrameworkCore.DbContext.SaveChanges(bool acceptAllChangesOnSuccess)


Microsoft.EntityFrameworkCore.DbContext.SaveChanges()


Anabi.DataAccess.Ef.DbInitializer.AdaugaSpatiiStocare(AnabiContext context) in DbInitializer.cs
+ 






113.            context.SaveChanges();








Anabi.DataAccess.Ef.DbInitializer.Initialize(AnabiContext context) in DbInitializer.cs
+ 






43.            AdaugaSpatiiStocare(context);








Anabi.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in Startup.cs
+ 






131.            DbInitializer.Initialize(context);








System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()


Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)


Microsoft.AspNetCore.ApplicationInsights.HostingStartup.ApplicationInsightsLoggerStartupFilter+<>c__DisplayClass0_1.<Configure>b__0(IApplicationBuilder builder)


Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter+<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)


Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter+<>c__DisplayClass3_0.<Configure>b__0(IApplicationBuilder app)


Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)


Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Adaugare bun la un storage space

Controller nou in Anabi - Features - Assets: AssetStorageSpaceController

Cu endpoint nou pt adaugare:
PUT /api/assets/{id}/storagespace

Payload:
*storageSpaceId
*entryDate

Handler nou: AssetStorageSpaceHandler
Vezi model AssetHandler

[ANABI feedback] Modificare proprietate Stare actuala

Proprietatea Stare actuala reprezinta acum de fapt tipul de procedura, trebuie redenumita.
Trebuie sa exista un camp de stare actuala, dar are alte valori, care depind foarte mult de tipul de procedura - sunt diferite pentru Valorificare anticipata, Sechestru, etc.

[ANABI feedback] Unitati de masura

  • definire "metru patrat" ca si unitate de masura pentru case/terenuri
  • unitate de masura devin free text - multe din obiectele confiscate au unitati de masura variabile si campul trebuie sa permita utilizatorului sa introduca orice valoare

[ANABI feedback] Corelare bunuri

Exista situatii in care un bun introdus agregat (o flota de masini) trebuie sa fie "spart" in mai multe bunuri.
Ar fi util sa existe un mod de a corela bunul introdus initial cu mai multe bunuri care sunt introduse la o data ulterioara si care se refera la aceleasi bunuri.
Relatia de corelare tb sa fie si de la parinte la copii, si de la bunul copil la parinte.
Relatia de corelare se face pe baza de id.

Chei externe care trebuiesc inlaturate

Bug description
Cand se creeaza baza de date apar in mai multe tabele niste chei externe catre tabela User.

Step to reproduce it
La crearea bazei de date.

Expected behavior
Cheile externe nu tb sa apara.

Additional info
Trebuiesc sterse ICollection-urile din UserDb

[ANABI feedback] Stare bunuri in procedura de valorificare anticipata

Un bun aflat in procedura de valorificare anticipata are 2 stari posibile:

  • evaluare
  • valorificare

Fiecare din etape contine informatiile:
Etapa de evaluare

  • evaluare bun

    • da/nu
    • comisie (nume, prenume)
  • raport evaluare

    • necontractat
    • contractat
    • primit

Etapa de valorificare

  • constituire comisie
  • licitatia 1 - data, comisie
  • licitatia 2 - data, comisie
  • licitatia 3 - data, comisie
  • licitatia n - data, comisie

Job redundant în pipeline

Bug description
docker build este executat de două ori în build-urile de pe master, dublând timpul de așteptare pentru deploy.

Step to reproduce it
Compară pașii și timpul de execuție al unui build recent cu cei ai unui build mai vechi.

Expected behavior
docker build să fie executat o singură dată.

Additional info
Introdus în dc52edd, cu următorul comentariu:

If building the image fails, then it shouldn't be merged.
Running unit tests, etc. should probably go in the Dockerfile,
anyway.

Variante de rezolvare

  1. Revert la versiunea inițială, dar cu actual tests în loc de placeholder:
jobs:
  include:
-    - stage: build image
-      script:
-        - docker build .
+    - stage: test
+      script:
+        - echo "Tests should go here"

    - stage: deploy
      name: "Build and publish image to registry"
      if: branch = master AND type != pull_request
  1. Execută job-ul pe toate branch-urile != master
jobs:
  include:
    - stage: build image
+     if: branch != master
      script:
        - docker build .

    - stage: deploy
      name: "Build and publish image to registry"
      if: branch = master AND type != pull_request

Model validation

Exemplu de model validation pe care il putem folosi ulterior cand avem toate informatiile

Reactivare EntityConfigurator

Bug description
Configurarea entitatilor din baza de date a fost comentata la un moment dat si tabelele nu mai sunt configurate corect.

Step to reproduce it
La crearea bazei de date.

Expected behavior
Entitatile sa fie create corespunzator.

Additional info
Clasele care configureaza au fost comentate in clasa AnabiContext. Trebuie verificat si daca ce scrie in ele mai este de actualitate.
EF Core ofera o clasa noua pentru acest tip de operatie. Ar tb folosita aceea.

Repositories should not return IQueryable

The project that handles the connection and mapping with the database should not return entities from the database, instead it should return DTO objects.
This happens for certain reasons:

  1. The system becomes tightly-coupled. If the underlying storage changes, all upper-level projects that depend on these classes have to change. Instead, if the DTO remains the same, it does not matter how the storage is structured.
  2. exposing the tables directly to the Web project is kind of a security issue. Let's say that by enforcing certain code policies, all developers are required to apply a transform method, and all controllers should return DTO objects. But we know that in real life, 'code hacks' are going to happen, and most probably some developers are going to return these entities directly through the API.

The repository pattern should provide a clear separation between the application and the database access. The Web project should not know about the database.
You can read more at IQueryable from a Repository Pattern is an anti-pattern

Ca un utilizator ANABI, vreau sa am o lista de judete (counties)

Avem un endpoint (/api/Counties) care ar trebui sa intoarca o lista de judete.
Lipsa judetelor duce la probleme in endpointurile de StorageSpaces pentru ca acolo avem un parametru countyCode care nu poate fi populat in acest moment si generaza un HTTP 500.

Ca un utilizator ANABI vreau sa caut un bun (cautare avansata dupa decizie, dosar, inculpat)

Vreau sa caut un bun dupa:

  • numar decizie
  • numar dosar
  • cnp/cui inculpat
  • nume inculpat

Rezultatul cautarii trebuie sa fie un tabel similar cu cel de la listare bunuri (care apare cand dau click pe "Bunuri"), dar, ideal, cu coloanele din wireframe (ID bun, nume inculpat, numar decizie, numar dosar, stare bun , link catre VIEW BUN, link catre EDIT BUN).

Subtaskuri

  • Frontend - formular cautare
  • Backend - endpoint cautare bunuri (intoarce o lista de bunuri)
  • Frontend - afisare rezultat cautare cu coloanele din wireframe

Cautare_dropdown
Cautare
Cautare cu rezultate

Vreau sa adaug un spatiu de stocare (BE only, din Postman)

Proprietatile unui spatiu de stocare, din pagina de Entitati:

https://codeforromania.atlassian.net/wiki/spaces/ANABI/pages/267256067/Entit+i

Spațiu de depozitare - proprietăți

  • ID - camp obligatoriu - unic

  • Nume - camp obligatoriu - unic

  • Tip - camp obligatoriu

    contractat
    necontractat
    Terti
    inculpat
    institutie
    agent privat

  • Adresa - obiect

(Celelalte campuri cum ar fi tipul cladirii, suprafata, cine administreaza spatiul de depozitoare le vom adauga mai tarziu).

Adresa - proprietati

  • Județ - camp obligatoriu, obiect

  • Localitate - camp obligatoriu, camp liber

  • Strada - camp liber

  • Numar - numarul cladirii pe strada (string)

  • Detalii - camp liber

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.