From 1813eae57c58bee713c20f7431083282c4baedf3 Mon Sep 17 00:00:00 2001 From: Ozodbek <145344998+OlimjonovOzodbek@users.noreply.github.com> Date: Tue, 17 Sep 2024 00:25:23 +0500 Subject: [PATCH] payment --- .../Controllers/PaymentController.cs | 46 ++ UrphaCapital.API/UrphaCapital.API.csproj | 2 + .../b517aa80-242b-49f4-9f4e-81baa681e56a.jfif | Bin 0 -> 10279 bytes .../667d9b39-e7f1-4579-bf16-519e4a9c56b7.jfif | Bin 0 -> 10279 bytes .../Abstractions/IApplicationDbContext.cs | 1 + .../Payments/Commands/CreatePaymentCommand.cs | 18 + .../Handlers/CreatePaymentCommandHandler.cs | 45 ++ .../Payments/Queries/GetAllPaymentsQuery.cs | 16 + .../GetAllPaymentsQueryHandler.cs | 29 ++ UrphaCapital.Domain/Entities/Payment.cs | 2 +- .../20240916190519_usus.Designer.cs | 462 ++++++++++++++++++ .../Migrations/20240916190519_usus.cs | 75 +++ .../UrphaCapitalDbContextModelSnapshot.cs | 53 +- .../Persistanse/UrphaCapitalDbContext.cs | 1 + 14 files changed, 747 insertions(+), 3 deletions(-) create mode 100644 UrphaCapital.API/Controllers/PaymentController.cs create mode 100644 UrphaCapital.API/wwwroot/CoursesPictures/b517aa80-242b-49f4-9f4e-81baa681e56a.jfif create mode 100644 UrphaCapital.API/wwwroot/MentorsPictures/667d9b39-e7f1-4579-bf16-519e4a9c56b7.jfif create mode 100644 UrphaCapital.Application/UseCases/Payments/Commands/CreatePaymentCommand.cs create mode 100644 UrphaCapital.Application/UseCases/Payments/Handlers/CreatePaymentCommandHandler.cs create mode 100644 UrphaCapital.Application/UseCases/Payments/Queries/GetAllPaymentsQuery.cs create mode 100644 UrphaCapital.Application/UseCases/Payments/QueriesHandler/GetAllPaymentsQueryHandler.cs create mode 100644 UrphaCapital.Infrastructure/Migrations/20240916190519_usus.Designer.cs create mode 100644 UrphaCapital.Infrastructure/Migrations/20240916190519_usus.cs diff --git a/UrphaCapital.API/Controllers/PaymentController.cs b/UrphaCapital.API/Controllers/PaymentController.cs new file mode 100644 index 0000000..8a72953 --- /dev/null +++ b/UrphaCapital.API/Controllers/PaymentController.cs @@ -0,0 +1,46 @@ +using MediatR; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using UrphaCapital.Application.UseCases.Admins.Commands; +using UrphaCapital.Application.UseCases.Admins.Queries; +using UrphaCapital.Application.UseCases.Payments.Commands; +using UrphaCapital.Application.UseCases.Payments.Queries; +using UrphaCapital.Application.ViewModels; +using UrphaCapital.Domain.Entities; +using UrphaCapital.Domain.Entities.Auth; + +namespace UrphaCapital.API.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class PaymentController : ControllerBase + { + private readonly IMediator _mediator; + + public PaymentController(IMediator mediator) + { + _mediator = mediator; + } + + [HttpPost] + public async Task PostPayment([FromBody] CreatePaymentCommand command, CancellationToken cancellation) + { + var response = await _mediator.Send(command, cancellation); + + return response; + } + [HttpGet("{index}/{count}")] + public async Task> GetPayments(int index, int count, CancellationToken cancellation) + { + var query = new GetAllPaymentsQuery() + { + Index = index, + Count = count + }; + + var response = await _mediator.Send(query, cancellation); + + return response; + } + } +} diff --git a/UrphaCapital.API/UrphaCapital.API.csproj b/UrphaCapital.API/UrphaCapital.API.csproj index dd4209f..131f687 100644 --- a/UrphaCapital.API/UrphaCapital.API.csproj +++ b/UrphaCapital.API/UrphaCapital.API.csproj @@ -25,4 +25,6 @@ + + diff --git a/UrphaCapital.API/wwwroot/CoursesPictures/b517aa80-242b-49f4-9f4e-81baa681e56a.jfif b/UrphaCapital.API/wwwroot/CoursesPictures/b517aa80-242b-49f4-9f4e-81baa681e56a.jfif new file mode 100644 index 0000000000000000000000000000000000000000..dfaadad9cd120a80d7fe206e53c545bb8200b2a1 GIT binary patch literal 10279 zcmY*;byVE3v+oyoDDG0El%=>su~KAl_u{@RuEn8vahJu4YjJnC7I)X;E=6yD@4ol$ zxs!8dlFa91CdnU@nY=E%ZUAp&rNB}E92@|^{cFJ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56b7.jfif new file mode 100644 index 0000000000000000000000000000000000000000..dfaadad9cd120a80d7fe206e53c545bb8200b2a1 GIT binary patch literal 10279 zcmY*;byVE3v+oyoDDG0El%=>su~KAl_u{@RuEn8vahJu4YjJnC7I)X;E=6yD@4ol$ zxs!8dlFa91CdnU@nY=E%ZUAp&rNB}E92@|^{cFJMGVl#RLq@^J$0fwW$0sBtBqAXp zCL|#yCMF>wBqb#IH~QBlp?pt6Le4-*O!$`LEdvuXD=RB8H5We@3*UPdR%SSKbaZSi zY_d0R$e9_a8Q54@SXf#9!~dID|Bv`@{{QCww|wmaa8ZE`U;_b;7J$cvL%@Z5?E}aG z03IIUpOgQe5Rnj&;own#e@dx006ZK#A_5X33Niu;BErA@z~cf4h>!wx%&@- z3y1=HnT+I6N1{{xMtj;YbC8Z+kJyK{v3`ydYLed72A0KMZHd(Crih_lwas}4%Uv)r zf`k93R3WIO!x7kS!&aftOE<7|5zLWKHVIO+%ykON1x%ngQac#WDK@p2|Q?K9kKCXW1+Pe6*! z4vD8*e2e1pH$eYcV@2vCRQ57ViQRe)nx7m4ac{qSdKCC<|U_CAL|r&+eV|Cx+?-p4Oj??ej}7SRX|m zrl96@EMtrLq`2{JVYh96;D1ML+#}YFrGDr7srgoNv^ks{pi{Mh#m8h&F8_Jnv#*V( zVUxPLF7Zh1HLG8-98Wokgk~sNjxLoXEJ?_H8cX^qyMVqb$i3%8pil3L1ZzRTIE29DN-1uYD-cZj$_t8vXvScpK)lqIam3O))_3m^FBu=EbE?_ySvqeU-08BJW)5(ZpM01UO z!K0BPMapmS==!%UjJ5f{vt9v^B_w3E*_J0mJ0uLxRb?!IY#>kAN@VkfK{4Zx%N4hv zSo!!1aR3|9)T!DV^jzyXw>x#EZuSlFhRq_AK<+}1kNhJPEE~Pb8VqLg;#oPGDIARf z0{|MOhNanpTntY3r{Ml@IJH)TZBgoTZE2#;l{o=`as z3``mN@Rcz7zBGy`EG)U7WrV#aG)c-hB`@_#@Rdz>=Wz$>BOz9i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rE#DYg@56xk% f;BT*I?syNVGUMvS8AOO#NkRyj2uldyUKjrh`B9a+ literal 0 HcmV?d00001 diff --git a/UrphaCapital.Application/Abstractions/IApplicationDbContext.cs b/UrphaCapital.Application/Abstractions/IApplicationDbContext.cs index 09808ef..9311e60 100644 --- a/UrphaCapital.Application/Abstractions/IApplicationDbContext.cs +++ b/UrphaCapital.Application/Abstractions/IApplicationDbContext.cs @@ -20,6 +20,7 @@ public interface IApplicationDbContext public DbSet Students { get; set; } public DbSet Homeworks { get; set; } public DbSet Helps { get; set; } + public DbSet Paymentss { get; set; } ValueTask SaveChangesAsync(CancellationToken cancellationToken = default!); } diff --git a/UrphaCapital.Application/UseCases/Payments/Commands/CreatePaymentCommand.cs b/UrphaCapital.Application/UseCases/Payments/Commands/CreatePaymentCommand.cs new file mode 100644 index 0000000..10c4dca --- /dev/null +++ b/UrphaCapital.Application/UseCases/Payments/Commands/CreatePaymentCommand.cs @@ -0,0 +1,18 @@ +using MediatR; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UrphaCapital.Application.ViewModels; + +namespace UrphaCapital.Application.UseCases.Payments.Commands +{ + public class CreatePaymentCommand: IRequest + { + public long StudentId { get; set; } + public Guid CourseId { get; set; } + public decimal Amount { get; set; } + public string PaymentStatus { get; set; } + } +} diff --git a/UrphaCapital.Application/UseCases/Payments/Handlers/CreatePaymentCommandHandler.cs b/UrphaCapital.Application/UseCases/Payments/Handlers/CreatePaymentCommandHandler.cs new file mode 100644 index 0000000..8e40aad --- /dev/null +++ b/UrphaCapital.Application/UseCases/Payments/Handlers/CreatePaymentCommandHandler.cs @@ -0,0 +1,45 @@ +using MediatR; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UrphaCapital.Application.Abstractions; +using UrphaCapital.Application.UseCases.Payments.Commands; +using UrphaCapital.Application.ViewModels; +using UrphaCapital.Domain.Entities; +using UrphaCapital.Domain.Entities.Auth; + +namespace UrphaCapital.Application.UseCases.Payments.Handlers +{ + public class CreatePaymentCommandHandler : IRequestHandler + { + private readonly IApplicationDbContext _context; + + public CreatePaymentCommandHandler(IApplicationDbContext context) + { + _context = context; + } + + public async Task Handle(CreatePaymentCommand request, CancellationToken cancellationToken) + { + var payment = new Payment() + { + StudentId = request.StudentId, + CourseId = request.CourseId, + Amount = request.Amount, + PaymentStatus = request.PaymentStatus, + }; + + await _context.Paymentss.AddAsync(payment); + await _context.SaveChangesAsync(cancellationToken); + + return new ResponseModel() + { + Message = "Created", + StatusCode = 200, + IsSuccess = true + }; + } + } +} diff --git a/UrphaCapital.Application/UseCases/Payments/Queries/GetAllPaymentsQuery.cs b/UrphaCapital.Application/UseCases/Payments/Queries/GetAllPaymentsQuery.cs new file mode 100644 index 0000000..25d410c --- /dev/null +++ b/UrphaCapital.Application/UseCases/Payments/Queries/GetAllPaymentsQuery.cs @@ -0,0 +1,16 @@ +using MediatR; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UrphaCapital.Domain.Entities; + +namespace UrphaCapital.Application.UseCases.Payments.Queries +{ + public class GetAllPaymentsQuery: IRequest> + { + public int Index { get; set; } + public int Count { get; set; } + } +} diff --git a/UrphaCapital.Application/UseCases/Payments/QueriesHandler/GetAllPaymentsQueryHandler.cs b/UrphaCapital.Application/UseCases/Payments/QueriesHandler/GetAllPaymentsQueryHandler.cs new file mode 100644 index 0000000..4810179 --- /dev/null +++ b/UrphaCapital.Application/UseCases/Payments/QueriesHandler/GetAllPaymentsQueryHandler.cs @@ -0,0 +1,29 @@ +using MediatR; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UrphaCapital.Application.Abstractions; +using UrphaCapital.Application.UseCases.Payments.Queries; +using UrphaCapital.Domain.Entities; + +namespace UrphaCapital.Application.UseCases.Payments.QueriesHandler +{ + public class GetAllPaymentsQueryHandler : IRequestHandler> + { + private readonly IApplicationDbContext _context; + + public GetAllPaymentsQueryHandler(IApplicationDbContext context) + { + _context = context; + } + + public async Task> Handle(GetAllPaymentsQuery request, CancellationToken cancellationToken) + { + return await _context.Paymentss.ToListAsync(cancellationToken); + } + } +} diff --git a/UrphaCapital.Domain/Entities/Payment.cs b/UrphaCapital.Domain/Entities/Payment.cs index 49fd6ec..d89c36c 100644 --- a/UrphaCapital.Domain/Entities/Payment.cs +++ b/UrphaCapital.Domain/Entities/Payment.cs @@ -13,9 +13,9 @@ public class Payment public long StudentId { get; set; } public Guid CourseId { get; set; } public decimal Amount { get; set; } + public string PaymentStatus { get; set; } public DateTimeOffset PaymentDate = DateTimeOffset.UtcNow; - public string PaymentStatus { get; set; } public Student Student { get; set; } public Course Course { get; set; } } diff --git a/UrphaCapital.Infrastructure/Migrations/20240916190519_usus.Designer.cs b/UrphaCapital.Infrastructure/Migrations/20240916190519_usus.Designer.cs new file mode 100644 index 0000000..275580c --- /dev/null +++ b/UrphaCapital.Infrastructure/Migrations/20240916190519_usus.Designer.cs @@ -0,0 +1,462 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using UrphaCapital.Infrastructure.Persistanse; + +#nullable disable + +namespace UrphaCapital.Infrastructure.Migrations +{ + [DbContext(typeof(UrphaCapitalDbContext))] + [Migration("20240916190519_usus")] + partial class usus + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Answer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("TestId") + .HasColumnType("bigint"); + + b.Property("isCorrect") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("TestId"); + + b.ToTable("Answers"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Auth.Admin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Role") + .IsRequired() + .HasColumnType("text"); + + b.Property("Salt") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Admins"); + + b.HasData( + new + { + Id = 1L, + Email = "admin@gmail.com", + Name = "Ozod Ali", + PasswordHash = "LXixSmGK1zCimS7HJigEQYR1MWACNvNMb9ARcmRusdU=", + PhoneNumber = "+998934013443", + Role = "SuperAdmin", + Salt = "c8dc5061-7022-41ee-b2aa-d397f56b3fb3" + }); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Auth.Mentor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Picture") + .IsRequired() + .HasColumnType("text"); + + b.Property("Role") + .IsRequired() + .HasColumnType("text"); + + b.Property("Salt") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Mentors"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Auth.Student", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property>("CourseIds") + .HasColumnType("text[]"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Role") + .IsRequired() + .HasColumnType("text"); + + b.Property("Salt") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Course", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("MentorId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Picture") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .IsRequired() + .HasColumnType("text"); + + b.Property("Subtitle") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("MentorId"); + + b.ToTable("Courses"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Help", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CourseType") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Helps"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Homeworks", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("FILE") + .IsRequired() + .HasColumnType("text"); + + b.Property("Grade") + .HasColumnType("integer"); + + b.Property("LessonId") + .HasColumnType("uuid"); + + b.Property("MentorId") + .HasColumnType("bigint"); + + b.Property("StudentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("LessonId"); + + b.ToTable("Homeworks"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Lesson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CourseId") + .HasColumnType("uuid"); + + b.Property("HomeworkDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Video") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.ToTable("Lessons"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("CourseId") + .HasColumnType("uuid"); + + b.Property("PaymentStatus") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.HasIndex("StudentId"); + + b.ToTable("Paymentss"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Test", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("LessonId") + .HasColumnType("uuid"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("LessonId"); + + b.ToTable("Tests"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Answer", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Test", "Test") + .WithMany("Answers") + .HasForeignKey("TestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Test"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Course", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Auth.Mentor", "Mentor") + .WithMany("Courses") + .HasForeignKey("MentorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Mentor"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Homeworks", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Lesson", "Lesson") + .WithMany() + .HasForeignKey("LessonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lesson"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Lesson", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Course", "Course") + .WithMany() + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Course"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Payment", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Course", "Course") + .WithMany() + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UrphaCapital.Domain.Entities.Auth.Student", "Student") + .WithMany() + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Course"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Test", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Lesson", "Lesson") + .WithMany() + .HasForeignKey("LessonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lesson"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Auth.Mentor", b => + { + b.Navigation("Courses"); + }); + + modelBuilder.Entity("UrphaCapital.Domain.Entities.Test", b => + { + b.Navigation("Answers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/UrphaCapital.Infrastructure/Migrations/20240916190519_usus.cs b/UrphaCapital.Infrastructure/Migrations/20240916190519_usus.cs new file mode 100644 index 0000000..03839bd --- /dev/null +++ b/UrphaCapital.Infrastructure/Migrations/20240916190519_usus.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace UrphaCapital.Infrastructure.Migrations +{ + /// + public partial class usus : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Paymentss", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StudentId = table.Column(type: "bigint", nullable: false), + CourseId = table.Column(type: "uuid", nullable: false), + Amount = table.Column(type: "numeric", nullable: false), + PaymentStatus = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Paymentss", x => x.Id); + table.ForeignKey( + name: "FK_Paymentss_Courses_CourseId", + column: x => x.CourseId, + principalTable: "Courses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Paymentss_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.UpdateData( + table: "Admins", + keyColumn: "Id", + keyValue: 1L, + columns: new[] { "PasswordHash", "Salt" }, + values: new object[] { "LXixSmGK1zCimS7HJigEQYR1MWACNvNMb9ARcmRusdU=", "c8dc5061-7022-41ee-b2aa-d397f56b3fb3" }); + + migrationBuilder.CreateIndex( + name: "IX_Paymentss_CourseId", + table: "Paymentss", + column: "CourseId"); + + migrationBuilder.CreateIndex( + name: "IX_Paymentss_StudentId", + table: "Paymentss", + column: "StudentId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Paymentss"); + + migrationBuilder.UpdateData( + table: "Admins", + keyColumn: "Id", + keyValue: 1L, + columns: new[] { "PasswordHash", "Salt" }, + values: new object[] { "njmXE2qt17lt9DCaV7m5cXLNyd07lyJqQbB5VeTfMfU=", "7b9a34e5-5d54-4c04-945e-c101ac484bf2" }); + } + } +} diff --git a/UrphaCapital.Infrastructure/Migrations/UrphaCapitalDbContextModelSnapshot.cs b/UrphaCapital.Infrastructure/Migrations/UrphaCapitalDbContextModelSnapshot.cs index 99a7fe9..8352a16 100644 --- a/UrphaCapital.Infrastructure/Migrations/UrphaCapitalDbContextModelSnapshot.cs +++ b/UrphaCapital.Infrastructure/Migrations/UrphaCapitalDbContextModelSnapshot.cs @@ -90,10 +90,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) Id = 1L, Email = "admin@gmail.com", Name = "Ozod Ali", - PasswordHash = "njmXE2qt17lt9DCaV7m5cXLNyd07lyJqQbB5VeTfMfU=", + PasswordHash = "LXixSmGK1zCimS7HJigEQYR1MWACNvNMb9ARcmRusdU=", PhoneNumber = "+998934013443", Role = "SuperAdmin", - Salt = "7b9a34e5-5d54-4c04-945e-c101ac484bf2" + Salt = "c8dc5061-7022-41ee-b2aa-d397f56b3fb3" }); }); @@ -318,6 +318,36 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Lessons"); }); + modelBuilder.Entity("UrphaCapital.Domain.Entities.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("CourseId") + .HasColumnType("uuid"); + + b.Property("PaymentStatus") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.HasIndex("StudentId"); + + b.ToTable("Paymentss"); + }); + modelBuilder.Entity("UrphaCapital.Domain.Entities.Test", b => { b.Property("Id") @@ -384,6 +414,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Course"); }); + modelBuilder.Entity("UrphaCapital.Domain.Entities.Payment", b => + { + b.HasOne("UrphaCapital.Domain.Entities.Course", "Course") + .WithMany() + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UrphaCapital.Domain.Entities.Auth.Student", "Student") + .WithMany() + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Course"); + + b.Navigation("Student"); + }); + modelBuilder.Entity("UrphaCapital.Domain.Entities.Test", b => { b.HasOne("UrphaCapital.Domain.Entities.Lesson", "Lesson") diff --git a/UrphaCapital.Infrastructure/Persistanse/UrphaCapitalDbContext.cs b/UrphaCapital.Infrastructure/Persistanse/UrphaCapitalDbContext.cs index fb98dc6..82457cb 100644 --- a/UrphaCapital.Infrastructure/Persistanse/UrphaCapitalDbContext.cs +++ b/UrphaCapital.Infrastructure/Persistanse/UrphaCapitalDbContext.cs @@ -28,6 +28,7 @@ public UrphaCapitalDbContext(DbContextOptions options) public DbSet Students { get; set; } public DbSet Homeworks { get; set; } public DbSet Helps { get; set; } + public DbSet Paymentss { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) {