{"id":25759313,"url":"https://github.com/koenverboven/schooladministrationapi","last_synced_at":"2025-02-26T17:29:59.526Z","repository":{"id":269289229,"uuid":"906683543","full_name":"KoenVerboven/SchoolAdministrationApi","owner":"KoenVerboven","description":" School Administration /  management API ","archived":false,"fork":false,"pushed_at":"2025-02-12T09:21:18.000Z","size":256,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T10:32:43.686Z","etag":null,"topics":["automapper","csharp","dependency-injection","dtos","entity-framework-core","fluentassertions","repository-pattern","serilog","sqlserver-2019","swagger","unit-testing","webapi","xunit"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KoenVerboven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-21T15:48:34.000Z","updated_at":"2025-02-12T09:21:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"87b3f2ae-cde2-47e9-9439-5d27ba4bb03d","html_url":"https://github.com/KoenVerboven/SchoolAdministrationApi","commit_stats":null,"previous_names":["koenverboven/schooladministrationapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoenVerboven%2FSchoolAdministrationApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoenVerboven%2FSchoolAdministrationApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoenVerboven%2FSchoolAdministrationApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoenVerboven%2FSchoolAdministrationApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KoenVerboven","download_url":"https://codeload.github.com/KoenVerboven/SchoolAdministrationApi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240901478,"owners_count":19875710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automapper","csharp","dependency-injection","dtos","entity-framework-core","fluentassertions","repository-pattern","serilog","sqlserver-2019","swagger","unit-testing","webapi","xunit"],"created_at":"2025-02-26T17:29:58.992Z","updated_at":"2025-02-26T17:29:59.512Z","avatar_url":"https://github.com/KoenVerboven.png","language":"C#","readme":"WEB API for schoolAdministration\n----------------------------------\n\nThis API, written in C#, is intended as a backend for an Angular website for school administration.\n\nA student can take 1 or more courses.\n\nA student can create 1 or more studyplans.\n\nWith the help of a studyplan, the student can plan a learning period, for example for a specific exam.\n\nA student can take an exam and view his results.\n\nA teacher gives 1 or more courses.\n\nA teacher can create 1 or more Exames.\n\nA teacher can give exam grades for a specific student\n\nStudent:\n* GetAllStudents\n* GetStudentById\n* GetExamResultsByStudentId\n* GetStudentByNameStartWith\n* CreateStudent\n* DeleteStudentById\n* UpdateStudent\n\nTeacher:\n* GetAllTeachers\n* GetTeacherById\n* CreateTeacher\n* DeleteTeacherById\n* UpdateTeacher\n\nCourse:\n\n* GetAllCoursers \n* GetCourseById \n* CreateCourse \n* DeleteCourse \n* UpdateCourse \n* SearchCourse on CourseName and CourseCode\n\nExamen:\n* GetAllExams\n* GetExamById\n* CreateExam\n* DeleteExamById\n* UpdateExamAsync\n\nExamenResult:\n* GetAllExamResult\n* GetExamResultById\n* CreateExamResult\n* DeleteExamById\n* UpdateExamResult\n\nStudyPlan:\n* GetAllStudyPlans\n* GetStudyPlanById, \n* CreateStudyPlan, \n* DeleteStudyPlanById,\n* UpdateStudyPlan\n\n\nCross-origin-requests :\n------------\nCors\n\nLogging :\n---------\nInstalled NuGet-packages :\n* Serilog.AspNetCore\n* Serilog.Sinks.file\n\nWith Serilog we can easly write our logs to a txt.file.\n\nProgram.cs:\n\n  Log.Logger = new LoggerConfiguration().MinimumLevel.Debug()\n      .WriteTo.File(\"log/villaLogs.txt\", rollingInterval: RollingInterval.Day).CreateLogger();\n  builder.Host.UseSerilog();\n\n  StudentController:\n\n  _logger.LogInformation(\"Getting all the students.\")\n\n\nExploring Endpoints :\n-----------------------------------\n We use Swagger.\n\n\nEntityFrameworkCore:\n--------------------\nInstalled NuGet-packages :\n* microsoft.entityframeworkcore.sqlserver\\9.0.0\n* entityframeworkcore.tools\\9.0.0\n\nWe use code first.\n\nBy Migrations we keep our database in SQL-Server in Sync.\n\nexample:\n\nType in Package Manager Console:\n\nAdd-Migration InitialMigration\n\nupdate-Database\n\n\nDependecy Injection :\n--------------------\nWhy we use Dependecy Injection?\n\nDependency injection aims to separate the concerns of constructing objects and using them,\n leading to loosely coupled programs.\n\n\nWe use DI for injection from : studentRepository,logger and mapper\n\n public StudentController(\n     IStudentRepository studentRepository,\n     ILogger\u003cStudentController\u003e logger,\n     IMapper mapper)\n\n In program.cs we must configure:\n \n builder.Services.AddScoped\u003cIStudentRepository, StudentRepository\u003e();\n\nAutoMapper : \n-------------\nInstalled NuGet-package :  \n* automapper\n\nTo map entities to DTO's and vice versa.\n\nDTO stands for Data Transfer Objects\n\nWhy we need DTO's to communicate with the outside world?\n\nExample : in our database we have fields to store 'insertDate' or 'insertedBy'\n\nIf we don't won't to share this fields with the outside world : we make a DTO \nwithout these fields.\n\nWe use par Controller 3 DTO's : one for update, one for insert, one for read\n\nWhy?\n\nBecause we do not need always the same data.\n\nExample : for insert we do not need a ID, for a update is ID necessary.\n \nMappingConfig:\n\n CreateMap\u003cStudent, StudentDTO\u003e().ReverseMap();\n \nIn the Controller we can write some like this:\n\n _mapper.Map \u003c StudentDTO \u003e (student)\n \nHere we map student to StudentDTO.\n\nVersioning:\n-----------\nInstalled NuGet-packages : \n* Microsoft.AspNetCore.Mvc.Versioning\n* Microsoft.AspNetCore.Mvc.Versioning.ApiExlorer\n\n  Program.cs :\n\n builder.Services.AddApiVersioning(options =\u003e\n {\n    options.AssumeDefaultVersionWhenUnspecified = true;\n    options.DefaultApiVersion = new Microsoft.AspNetCore.Mvc.ApiVersion(1, 0);\n });\n\n\nUnittesting : \n-------------\nadd new project to solution : xUnit test Project\n\nInstalled Nuget-Packages:\n* FluentAssertions\n* Moq\n\nMake a reference to SchoolAdministration project:\n\nRight click project SchoolAdministrationTests\n\nchoose Project Reference\n\nUnitTests :\n\n![image](https://github.com/user-attachments/assets/96426350-2387-4e3e-a6c5-d1930969257e)\n\n\nSwagger :Exploring Endpoints\n\n![localhost_7213_index html (2)](https://github.com/user-attachments/assets/37967a73-770c-444c-94ba-206baa648ff5)\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoenverboven%2Fschooladministrationapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoenverboven%2Fschooladministrationapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoenverboven%2Fschooladministrationapi/lists"}