Silver Screen API is the backend of the Silver Screen platform – a full-stack web application for discovering, organising and discussing movies and series with your friends. It delivers data to the companion Silver Screen UI.
Layer | Technology |
---|---|
Core | ASP.NET Core, C# |
Data Access | Entity Framework Core, MySQL |
Auth | JWT |
External API | TMDB |
DevOps | Silver Screen Docker, Bitbucket Pipelines |
- .NET 6 SDK
- Docker Desktop (or a local MySQL 8 instance)
- (Optional) TMDB API key for extended catalogue seeding
git clone https://github.com/vasilev17/silver-screen-api.git
cd silver-screen-api/SilverScreen
No. The Docker container initializes the database and the tables are initialized automatically when you run the app via migrations.
You can see them on the phpMyAdmin page or use MySQL Workbench.
There are multiple ways to modify a specific table:
- Use phpMyAdmin and modify the table via the UI.
- Use MySQL Workbench and write a query that adds, modifies or deletes the table.
- Modify the EF entities in the Models/Tables folder that corresponds to the table in the database.
Note
You need to update the database, otherwise it's not going to work.
This is a necessary task to complete if you modified the database in some way.
If you modified the databse externally via phpMyAdmin or MySQL Workbench you need to do the following / skip if you updated the entities directly /:
- Open the package manager console in Visual Studio
- Run this command:
Scaffold-DbContext "datasource=localhost;port=3306;database=SilverScreen;username=root;password=5w%q@IiwWQc8" MySql.EntityFrameworkCore -OutputDir "Models/Tables" -f
to update the EF entities.
When the EF entities are updated via scaffolding, it replaces the original SilverScreenContext.cs
file, which removes the configuration for the MySQL connection string, which will generate errors in some places.
Note
If you modified the database internally (modified the entities directly), you don't need to follow this instructions.
Here what to do in case of scaffolding:
- Find
optionsBuilder.UseMySQL
, and replace the entire row withoptionsBuilder.UseMySQL($"datasource={Environment.GetEnvironmentVariable("MYSQL_DATABASE_IP") ?? "localhost"}; port=3306; database=SilverScreen; username=root; password=" + Environment.GetEnvironmentVariable("SSDbPass"));
and remove the warning that starts with the#
symbol above.
After executing these steps or updating the entities directly, open the Package Manager console in Visual Studio and run this command: Add-Migration NameOfTheMigraion
.