From c681a72c845e4ed7e3039a4779be4fd2533ac8f9 Mon Sep 17 00:00:00 2001 From: "Johnny.Ratton" Date: Sun, 11 Feb 2024 11:42:44 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20des=20diff=C3=A9rents=20projets?= =?UTF-8?q?=20n=C3=A9cessaires=20pour=20l'API=20et=20la=20gestion=20de=20E?= =?UTF-8?q?ntityFramework.=20Installation=20des=20nugets=20n=C3=A9cessaire?= =?UTF-8?q?=20(utilisation=20de=20pgsql=20pour=20EF).=20Cr=C3=A9ation=20de?= =?UTF-8?q?s=20entit=C3=A9s=20+=20d=C3=A9but=20de=20la=20cr=C3=A9ation=20d?= =?UTF-8?q?es=20classes=20m=C3=A9tier,=20des=20DTO,=20des=20Mapper=20et=20?= =?UTF-8?q?des=20Service=20de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API_SQLuedo/API/API.csproj | 14 ++++++ API_SQLuedo/API/API.http | 6 +++ API_SQLuedo/API/Program.cs | 25 +++++++++++ .../API/Properties/launchSettings.json | 41 ++++++++++++++++++ API_SQLuedo/API/appsettings.Development.json | 8 ++++ API_SQLuedo/API/appsettings.json | 9 ++++ API_SQLuedo/API_SQLuedo.sln | 25 +++++++++++ API_SQLuedo/DbContextLib/DbContextLib.csproj | 9 ++++ API_SQLuedo/DbContextLib/UserDbContext.cs | 22 ++++++++++ API_SQLuedo/EntityFramework/Entities.csproj | 9 ++++ .../SQLudeoDB/BlackListEntity.cs | 22 ++++++++++ .../SQLudeoDB/ContentLessonEntity.cs | 23 ++++++++++ .../SQLudeoDB/InquiryEntity.cs | 29 +++++++++++++ .../SQLudeoDB/InquiryTableEntity.cs | 32 ++++++++++++++ .../EntityFramework/SQLudeoDB/LessonEntity.cs | 32 ++++++++++++++ .../SQLudeoDB/NotepadEntity.cs | 43 +++++++++++++++++++ .../SQLudeoDB/ParagraphEntity.cs | 32 ++++++++++++++ .../SQLudeoDB/SolutionEntity.cs | 41 ++++++++++++++++++ .../SQLudeoDB/SuccessEntity.cs | 38 ++++++++++++++++ .../EntityFramework/SQLudeoDB/UserEntity.cs | 30 +++++++++++++ API_SQLuedo/Model/Business/Inquiry.cs | 12 ++++++ API_SQLuedo/Model/Business/User.cs | 7 +++ API_SQLuedo/Model/DTO/InquiryDTO.cs | 12 ++++++ API_SQLuedo/Model/DTO/UserDTO.cs | 12 ++++++ API_SQLuedo/Model/Mappers/IMapper.cs | 16 +++++++ API_SQLuedo/Model/Mappers/InquiryMapper.cs | 31 +++++++++++++ API_SQLuedo/Model/Mappers/UserMapper.cs | 31 +++++++++++++ API_SQLuedo/Model/Model.csproj | 9 ++++ API_SQLuedo/Services/IDataService.cs | 13 ++++++ API_SQLuedo/Services/Services.csproj | 9 ++++ API_SQLuedo/TestAPI/GlobalUsings.cs | 1 + API_SQLuedo/TestAPI/TestAPI.csproj | 25 +++++++++++ API_SQLuedo/TestAPI/UnitTest1.cs | 11 +++++ API_SQLuedo/TestEF/GlobalUsings.cs | 1 + API_SQLuedo/TestEF/TestEF.csproj | 25 +++++++++++ API_SQLuedo/TestEF/UnitTest1.cs | 11 +++++ 36 files changed, 716 insertions(+) create mode 100644 API_SQLuedo/API/API.csproj create mode 100644 API_SQLuedo/API/API.http create mode 100644 API_SQLuedo/API/Program.cs create mode 100644 API_SQLuedo/API/Properties/launchSettings.json create mode 100644 API_SQLuedo/API/appsettings.Development.json create mode 100644 API_SQLuedo/API/appsettings.json create mode 100644 API_SQLuedo/API_SQLuedo.sln create mode 100644 API_SQLuedo/DbContextLib/DbContextLib.csproj create mode 100644 API_SQLuedo/DbContextLib/UserDbContext.cs create mode 100644 API_SQLuedo/EntityFramework/Entities.csproj create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/BlackListEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/ContentLessonEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/InquiryEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/InquiryTableEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/LessonEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/NotepadEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/ParagraphEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/SolutionEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/SuccessEntity.cs create mode 100644 API_SQLuedo/EntityFramework/SQLudeoDB/UserEntity.cs create mode 100644 API_SQLuedo/Model/Business/Inquiry.cs create mode 100644 API_SQLuedo/Model/Business/User.cs create mode 100644 API_SQLuedo/Model/DTO/InquiryDTO.cs create mode 100644 API_SQLuedo/Model/DTO/UserDTO.cs create mode 100644 API_SQLuedo/Model/Mappers/IMapper.cs create mode 100644 API_SQLuedo/Model/Mappers/InquiryMapper.cs create mode 100644 API_SQLuedo/Model/Mappers/UserMapper.cs create mode 100644 API_SQLuedo/Model/Model.csproj create mode 100644 API_SQLuedo/Services/IDataService.cs create mode 100644 API_SQLuedo/Services/Services.csproj create mode 100644 API_SQLuedo/TestAPI/GlobalUsings.cs create mode 100644 API_SQLuedo/TestAPI/TestAPI.csproj create mode 100644 API_SQLuedo/TestAPI/UnitTest1.cs create mode 100644 API_SQLuedo/TestEF/GlobalUsings.cs create mode 100644 API_SQLuedo/TestEF/TestEF.csproj create mode 100644 API_SQLuedo/TestEF/UnitTest1.cs diff --git a/API_SQLuedo/API/API.csproj b/API_SQLuedo/API/API.csproj new file mode 100644 index 0000000..ba558e4 --- /dev/null +++ b/API_SQLuedo/API/API.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + true + + + + + + + diff --git a/API_SQLuedo/API/API.http b/API_SQLuedo/API/API.http new file mode 100644 index 0000000..59bea7e --- /dev/null +++ b/API_SQLuedo/API/API.http @@ -0,0 +1,6 @@ +@API_HostAddress = http://localhost:5015 + +GET {{API_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/API_SQLuedo/API/Program.cs b/API_SQLuedo/API/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/API_SQLuedo/API/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/API_SQLuedo/API/Properties/launchSettings.json b/API_SQLuedo/API/Properties/launchSettings.json new file mode 100644 index 0000000..63ba7b8 --- /dev/null +++ b/API_SQLuedo/API/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:64538", + "sslPort": 44356 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5015", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7259;http://localhost:5015", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/API_SQLuedo/API/appsettings.Development.json b/API_SQLuedo/API/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/API_SQLuedo/API/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/API_SQLuedo/API/appsettings.json b/API_SQLuedo/API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/API_SQLuedo/API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/API_SQLuedo/API_SQLuedo.sln b/API_SQLuedo/API_SQLuedo.sln new file mode 100644 index 0000000..a19c322 --- /dev/null +++ b/API_SQLuedo/API_SQLuedo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34408.163 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "API", "API\API.csproj", "{65F4AE69-E1CA-4B87-BDF0-946A37351BD1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {65F4AE69-E1CA-4B87-BDF0-946A37351BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65F4AE69-E1CA-4B87-BDF0-946A37351BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65F4AE69-E1CA-4B87-BDF0-946A37351BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65F4AE69-E1CA-4B87-BDF0-946A37351BD1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B1212232-F848-49A7-B5F9-0E66FD538A6F} + EndGlobalSection +EndGlobal diff --git a/API_SQLuedo/DbContextLib/DbContextLib.csproj b/API_SQLuedo/DbContextLib/DbContextLib.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/API_SQLuedo/DbContextLib/DbContextLib.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/API_SQLuedo/DbContextLib/UserDbContext.cs b/API_SQLuedo/DbContextLib/UserDbContext.cs new file mode 100644 index 0000000..f231236 --- /dev/null +++ b/API_SQLuedo/DbContextLib/UserDbContext.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore; + +namespace DbContextLib +{ + public class UserDbContext : DbContext + { + public UserDbContext(DbContextOptions options) : base(options) { } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { + optionsBuilder.UseNpgsql("Host=localhost;Database=SQLuedo;Username=admin;Password=password"); + } + base.OnConfiguring(optionsBuilder); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + } + } +} diff --git a/API_SQLuedo/EntityFramework/Entities.csproj b/API_SQLuedo/EntityFramework/Entities.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/API_SQLuedo/EntityFramework/Entities.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/BlackListEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/BlackListEntity.cs new file mode 100644 index 0000000..0bd485b --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/BlackListEntity.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities.SQLudeoDB +{ + public class BlackListEntity + { + [Key] + public string Email { get; set; } + public DateOnly ExpirationDate { get; set; } + public BlackListEntity() { } + public BlackListEntity(string email, DateOnly expirationDate) + { + Email = email; + ExpirationDate = expirationDate; + } + } +} diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/ContentLessonEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/ContentLessonEntity.cs new file mode 100644 index 0000000..aba1388 --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/ContentLessonEntity.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities +{ + internal class ContentLessonEntity + { + [Key, Column(Order = 0)] + [ForeignKey(nameof(Lesson))] + public int LessonId { get; set; } + public LessonEntity Lesson { get; set; } + + [Key, Column(Order = 1)] + [ForeignKey(nameof(Paragraph))] + public int LessonPartId { get; set; } + public ParagraphEntity Paragraph { get; set; } + } +} diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/InquiryEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/InquiryEntity.cs new file mode 100644 index 0000000..0b767f6 --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/InquiryEntity.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities +{ + public class InquiryEntity + { + public int Id { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public bool IsUser { get; set; } + public InquiryTableEntity Database { get; set; } + public SolutionEntity InquiryTable { get; set; } + public InquiryEntity() { } + + public InquiryEntity(int id, string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) + { + Id = id; + Title = title; + Description = description; + IsUser = isUser; + Database = database; + InquiryTable = inquiryTable; + } + } +} diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/InquiryTableEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/InquiryTableEntity.cs new file mode 100644 index 0000000..5f1d552 --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/InquiryTableEntity.cs @@ -0,0 +1,32 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace Entities +{ + public class InquiryTableEntity + { + [Key] + [ForeignKey(nameof(Owner))] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Required] + public int OwnerId { get; set; } + public InquiryEntity Owner { get; set; } + public string DatabaseName { get; set; } + public string ConnectionInfo { get; set; } + + public InquiryTableEntity() { } + public InquiryTableEntity(int inquiryId, string databaseName, string connectionInfo) + { + OwnerId = inquiryId; + DatabaseName = databaseName; + ConnectionInfo = connectionInfo; + } + + public InquiryTableEntity(InquiryEntity owner, string databaseName, string connectionInfo) + { + Owner = owner; + DatabaseName = databaseName; + ConnectionInfo = connectionInfo; + } + } +} \ No newline at end of file diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/LessonEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/LessonEntity.cs new file mode 100644 index 0000000..c2b9f6c --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/LessonEntity.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities +{ + public class LessonEntity + { + public int Id { get; set; } + public string Titla { get; set; } + public string LastPublisher { get; set; } + public DateOnly LastEdit { get; set; } + + public LessonEntity() { } + public LessonEntity(int id, string titla, string lastPublisher, DateOnly lastEdit) + { + Id = id; + Titla = titla; + LastPublisher = lastPublisher; + LastEdit = lastEdit; + } + + public LessonEntity(string titla, string lastPublisher, DateOnly lastEdit) + { + Titla = titla; + LastPublisher = lastPublisher; + LastEdit = lastEdit; + } + } +} diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/NotepadEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/NotepadEntity.cs new file mode 100644 index 0000000..a68e91d --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/NotepadEntity.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities.SQLudeoDB +{ + public class NotepadEntity + { + public int Id { get; set; } + + [ForeignKey(nameof(User))] + public int UserId { get; set; } + public UserEntity User { get; set; } + + [ForeignKey(nameof(Inquiry))] + public int InquiryId { get; set; } + public InquiryEntity Inquiry { get; set; } + public string Notes { get; set; } + + public NotepadEntity() { } + + public NotepadEntity(int id, int userId, UserEntity user, int inquiryId, InquiryEntity inquiry, string notes) + { + Id = id; + UserId = userId; + User = user; + InquiryId = inquiryId; + Inquiry = inquiry; + Notes = notes; + } + public NotepadEntity(int userId, UserEntity user, int inquiryId, InquiryEntity inquiry, string notes) + { + UserId = userId; + User = user; + InquiryId = inquiryId; + Inquiry = inquiry; + Notes = notes; + } + } +} diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/ParagraphEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/ParagraphEntity.cs new file mode 100644 index 0000000..3fc03bb --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/ParagraphEntity.cs @@ -0,0 +1,32 @@ +namespace Entities +{ + public class ParagraphEntity + { + public int Id { get; set; } + public string Title { get; set; } + public string Content { get; set; } + public string Info { get; set; } + public string Query { get; set; } + public string Comment { get; set; } + + public ParagraphEntity() { } + + public ParagraphEntity(int id, string title, string content, string info, string query, string comment) + { + Id = id; + Title = title; + Content = content; + Info = info; + Query = query; + Comment = comment; + } + public ParagraphEntity(string title, string content, string info, string query, string comment) + { + Title = title; + Content = content; + Info = info; + Query = query; + Comment = comment; + } + } +} \ No newline at end of file diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/SolutionEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/SolutionEntity.cs new file mode 100644 index 0000000..38b8ce0 --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/SolutionEntity.cs @@ -0,0 +1,41 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Security.Cryptography.X509Certificates; + +namespace Entities +{ + public class SolutionEntity + { + [Key] + [ForeignKey(nameof(Owner))] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Required] + public int OwnerId { get; set; } + public InquiryEntity Owner { get; set; } + public string MurdererFirstName { get; set; } + public string MurdererLastName { get; set; } + public string MurderPlace { get; set; } + public string MurderWeapon { get; set; } + public string Explanation { get; set; } + public SolutionEntity() { } + public SolutionEntity(int ownerId, InquiryEntity owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) + { + OwnerId = ownerId; + Owner = owner; + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; + } + public SolutionEntity(InquiryEntity owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) + { + Owner = owner; + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; + } + } +} \ No newline at end of file diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/SuccessEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/SuccessEntity.cs new file mode 100644 index 0000000..7265cc5 --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/SuccessEntity.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities.SQLudeoDB +{ + public class SuccessEntity + { + [Key, Column(Order = 0), ForeignKey(nameof(User))] + public int UserId { get; set; } + public UserEntity User { get; set; } + + [Key, Column(Order = 1), ForeignKey(nameof(Inquiry))] + public int InquiryId { get; set; } + public InquiryEntity Inquiry { get; set; } + public bool IsFinished { get; set; } + + public SuccessEntity() { } + + public SuccessEntity(int userId, int inquiryId, bool isFinished) + { + UserId = userId; + InquiryId = inquiryId; + IsFinished = isFinished; + } + + public SuccessEntity(UserEntity user, InquiryEntity inquiry, bool isFinished) + { + User = user; + Inquiry = inquiry; + IsFinished = isFinished; + } + } +} diff --git a/API_SQLuedo/EntityFramework/SQLudeoDB/UserEntity.cs b/API_SQLuedo/EntityFramework/SQLudeoDB/UserEntity.cs new file mode 100644 index 0000000..41d1bf0 --- /dev/null +++ b/API_SQLuedo/EntityFramework/SQLudeoDB/UserEntity.cs @@ -0,0 +1,30 @@ +namespace EntityFramework +{ + public class UserEntity + { + public int Id { get; set; } + public string Username { get; set; } + public string Password { get; set; } + public string Email { get; set; } + public bool IsAdmin { get; set; } + + public UserEntity() { } + + public UserEntity(int id, string username, string password, string email, bool isAdmin) + { + Id = id; + Username = username; + Password = password; + Email = email; + IsAdmin = isAdmin; + } + + public UserEntity(string username, string password, string email, bool isAdmin) + { + Username = username; + Password = password; + Email = email; + IsAdmin = isAdmin; + } + } +} diff --git a/API_SQLuedo/Model/Business/Inquiry.cs b/API_SQLuedo/Model/Business/Inquiry.cs new file mode 100644 index 0000000..e867bd0 --- /dev/null +++ b/API_SQLuedo/Model/Business/Inquiry.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Business +{ + public class Inquiry + { + } +} diff --git a/API_SQLuedo/Model/Business/User.cs b/API_SQLuedo/Model/Business/User.cs new file mode 100644 index 0000000..1a66f49 --- /dev/null +++ b/API_SQLuedo/Model/Business/User.cs @@ -0,0 +1,7 @@ +namespace Model.Business +{ + public class UserDTO + { + + } +} diff --git a/API_SQLuedo/Model/DTO/InquiryDTO.cs b/API_SQLuedo/Model/DTO/InquiryDTO.cs new file mode 100644 index 0000000..f4060db --- /dev/null +++ b/API_SQLuedo/Model/DTO/InquiryDTO.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.DTO +{ + public class InquiryDTO + { + } +} diff --git a/API_SQLuedo/Model/DTO/UserDTO.cs b/API_SQLuedo/Model/DTO/UserDTO.cs new file mode 100644 index 0000000..86cde9a --- /dev/null +++ b/API_SQLuedo/Model/DTO/UserDTO.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.DTO +{ + public class UserDTO + { + } +} diff --git a/API_SQLuedo/Model/Mappers/IMapper.cs b/API_SQLuedo/Model/Mappers/IMapper.cs new file mode 100644 index 0000000..ff4c6cb --- /dev/null +++ b/API_SQLuedo/Model/Mappers/IMapper.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Mappers +{ + public interface IMapper + { + public Object FromEntityToModel(); + public Object FromModelToDTO(); + public Object FromDTOToModel(); + public Object FromModelToEntity(); + } +} diff --git a/API_SQLuedo/Model/Mappers/InquiryMapper.cs b/API_SQLuedo/Model/Mappers/InquiryMapper.cs new file mode 100644 index 0000000..33a4140 --- /dev/null +++ b/API_SQLuedo/Model/Mappers/InquiryMapper.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Mappers +{ + public class InquiryMapper : IMapper + { + public object FromDTOToModel() + { + throw new NotImplementedException(); + } + + public object FromEntityToModel() + { + throw new NotImplementedException(); + } + + public object FromModelToDTO() + { + throw new NotImplementedException(); + } + + public object FromModelToEntity() + { + throw new NotImplementedException(); + } + } +} diff --git a/API_SQLuedo/Model/Mappers/UserMapper.cs b/API_SQLuedo/Model/Mappers/UserMapper.cs new file mode 100644 index 0000000..5bc189c --- /dev/null +++ b/API_SQLuedo/Model/Mappers/UserMapper.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Mappers +{ + public class UserMapper : IMapper + { + public object FromDTOToModel() + { + throw new NotImplementedException(); + } + + public object FromEntityToModel() + { + throw new NotImplementedException(); + } + + public object FromModelToDTO() + { + throw new NotImplementedException(); + } + + public object FromModelToEntity() + { + throw new NotImplementedException(); + } + } +} diff --git a/API_SQLuedo/Model/Model.csproj b/API_SQLuedo/Model/Model.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/API_SQLuedo/Model/Model.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/API_SQLuedo/Services/IDataService.cs b/API_SQLuedo/Services/IDataService.cs new file mode 100644 index 0000000..2919cc7 --- /dev/null +++ b/API_SQLuedo/Services/IDataService.cs @@ -0,0 +1,13 @@ +using Model.DTO; + +namespace Services +{ + public interface IDataService + { + public IEnumerable GetUsers(int page, int number); + public UserDTO GetUserById(int id); + public UserDTO GetUserByUsername(string username); + public IEnumerable GetInquiries(); + + } +} diff --git a/API_SQLuedo/Services/Services.csproj b/API_SQLuedo/Services/Services.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/API_SQLuedo/Services/Services.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/API_SQLuedo/TestAPI/GlobalUsings.cs b/API_SQLuedo/TestAPI/GlobalUsings.cs new file mode 100644 index 0000000..8c927eb --- /dev/null +++ b/API_SQLuedo/TestAPI/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/API_SQLuedo/TestAPI/TestAPI.csproj b/API_SQLuedo/TestAPI/TestAPI.csproj new file mode 100644 index 0000000..9e0c306 --- /dev/null +++ b/API_SQLuedo/TestAPI/TestAPI.csproj @@ -0,0 +1,25 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/API_SQLuedo/TestAPI/UnitTest1.cs b/API_SQLuedo/TestAPI/UnitTest1.cs new file mode 100644 index 0000000..c22e82f --- /dev/null +++ b/API_SQLuedo/TestAPI/UnitTest1.cs @@ -0,0 +1,11 @@ +namespace TestAPI +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + + } + } +} \ No newline at end of file diff --git a/API_SQLuedo/TestEF/GlobalUsings.cs b/API_SQLuedo/TestEF/GlobalUsings.cs new file mode 100644 index 0000000..8c927eb --- /dev/null +++ b/API_SQLuedo/TestEF/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/API_SQLuedo/TestEF/TestEF.csproj b/API_SQLuedo/TestEF/TestEF.csproj new file mode 100644 index 0000000..9e0c306 --- /dev/null +++ b/API_SQLuedo/TestEF/TestEF.csproj @@ -0,0 +1,25 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/API_SQLuedo/TestEF/UnitTest1.cs b/API_SQLuedo/TestEF/UnitTest1.cs new file mode 100644 index 0000000..68b7186 --- /dev/null +++ b/API_SQLuedo/TestEF/UnitTest1.cs @@ -0,0 +1,11 @@ +namespace TestEF +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + + } + } +} \ No newline at end of file