Code Monkey home page Code Monkey logo

de-urgenta-backend's Introduction

De urgenta - Backend API

GitHub contributors GitHub last commit License: MPL 2.0

Check out the Wiki!

De Urgență was prototyped in Code for Romania's research project, Civic Labs.

The application aims to inform citizens about how to react to the first critical hours in a crisis situation (like that of an earthquake).

It also aims to build healthy habits that become ingrained with time, so that, when the critical moment arrives, each person knows what the key first steps to keeping themselves safe are.

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. If you want to make any change to this repository, please make a fork first.

If you would like to suggest new functionality, open an Issue and mark it as a [Feature request]. Please be specific about why you think this functionality will be of use. If you can, please include some visual description of what you would like the UI to look like, if you are suggesting new UI elements.

Programming languages

.NET 5.0 (C#)

Package managers

NuGet

Database technology & provider

PostgreSQL

API endpoints

Swagger

Repos and projects

Android repo
iOS repo
Web app - frontend
Web app - backend

Development Tips

Get started with docker-compose

  1. Navigate to /src
  2. Copy .env.example to .env
  3. Build images (optional - they will be built in step 4. if they don't exist)
    docker-compose -p de-urgenta build
  4. Start your containers
    docker-compose -p de-urgenta up -d
  5. Navigate to http://localhost:5040/swagger

we use -p de-urgenta to distinguish this compose project and you can skip it if you want. (it would inherit src otherwise - you probably have some of those already running)

you can also specify a env file at runtime with docker-compose so you don't necessarily need to take step 2. - more info here

Start a postgres server

docker-compose -d up migrator postgres

Creating a EF Core migration from console

de-urgenta-backend\Src> dotnet ef migrations add <Migration-name> --project DeUrgenta.Domain.Api --startup-project DeUrgenta.Api --context DeUrgentaContext
de-urgenta-backend\Src> dotnet ef migrations add <Migration-name> --project DeUrgenta.Domain.Identity --startup-project DeUrgenta.Api --context UserDbContext
de-urgenta-backend\Src> dotnet ef migrations add <Migration-name> --project DeUrgenta.Domain.I18n --startup-project DeUrgenta.Api --context I18nDbContext
de-urgenta-backend\Src> dotnet ef migrations add <Migration-name> --project DeUrgenta.Domain.RecurringJobs --startup-project DeUrgenta.RecurringJobs --context JobsContext

Domains migrator

We use a special project which will create databases (if not exists) and will apply migrations for every registered context. Use DeUrgenta.Domains.Migrator project to initialize an empty database.

Configuring storage

In order to store certification photos you will need to have either Local or S3 storage configured. Toggle between these two options by setting the StorageService app setting to the appropriate value.

Local storage needs no additional configuration. This option is suitable for development environments.

S3 storage requires having an AWS account configured, a bucket created and the following app settings:

"S3ConfigOptions": {
    "BucketName": "your-bucket-name",
    "PresignedUrlExpirationInMinutes": "10"
  }

Configuring recurring jobs

Recurring jobs can be turned on or off or scheduled at different intervals by using the following configuration section in the RecurringJobs.sln appsettings.json file.

"RecurringJobsConfig": {
    "ExpiredCertificationJobConfig": {
      "IsEnabled": "true",
      "CronExpression": "0 0 * * *",
      "DaysBeforeExpirationDate": "30"
    },
    ...
  },

Every jobs will have at least the IsEnabled and CronExpression settings, but additional settings can be added as needed.

Use crontab to generate valid cron expressions.

Using DB checkpoint for integration tests

To configure a DB to be cleaned after integration tests are run you can enable the UseDbCheckpoint option in the appsettings.testing.json

 "UseDbCheckpoint" : "true"

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 Code for Romania

Started in 2016, Code for Romania is a civic tech NGO, official member of the Code for All network. We have a community of around 2.000 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.

de-urgenta-backend's People

Contributors

decembrya avatar idormenco avatar catileptic avatar bvizureanu avatar vladcuciureanu avatar trupci avatar tudoramariei avatar doruu12 avatar aniri avatar laxynium avatar puiu avatar dsvdavid avatar gabrielmajeri avatar ursaciuc-adrian avatar anamarisimo avatar

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.