null paiment id
This commit is contained in:
@ -1,13 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "9.0.6",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
"tools": {}
|
||||
}
|
3504
src/Yavsc.Server/Migrations/20250715143821_nullPaimentIdOnQuery.Designer.cs
generated
Normal file
3504
src/Yavsc.Server/Migrations/20250715143821_nullPaimentIdOnQuery.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,182 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Yavsc.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class nullPaimentIdOnQuery : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HairCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairCutQueries");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HairMultiCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairMultiCutQueries");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Project_PayPalPayment_PaymentId",
|
||||
table: "Project");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RdvQueries_PayPalPayment_PaymentId",
|
||||
table: "RdvQueries");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "RdvQueries",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "Project",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "HairMultiCutQueries",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "HairCutQueries",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HairCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairCutQueries",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HairMultiCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairMultiCutQueries",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Project_PayPalPayment_PaymentId",
|
||||
table: "Project",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RdvQueries_PayPalPayment_PaymentId",
|
||||
table: "RdvQueries",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HairCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairCutQueries");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HairMultiCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairMultiCutQueries");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Project_PayPalPayment_PaymentId",
|
||||
table: "Project");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RdvQueries_PayPalPayment_PaymentId",
|
||||
table: "RdvQueries");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "RdvQueries",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "Project",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "HairMultiCutQueries",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PaymentId",
|
||||
table: "HairCutQueries",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HairCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairCutQueries",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HairMultiCutQueries_PayPalPayment_PaymentId",
|
||||
table: "HairMultiCutQueries",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Project_PayPalPayment_PaymentId",
|
||||
table: "Project",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RdvQueries_PayPalPayment_PaymentId",
|
||||
table: "RdvQueries",
|
||||
column: "PaymentId",
|
||||
principalTable: "PayPalPayment",
|
||||
principalColumn: "CreationToken",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -1226,7 +1226,6 @@ namespace Yavsc.Migrations
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PaymentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PerformerId")
|
||||
@ -1317,7 +1316,6 @@ namespace Yavsc.Migrations
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PaymentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PerformerId")
|
||||
@ -2283,7 +2281,6 @@ namespace Yavsc.Migrations
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("PaymentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PerformerId")
|
||||
@ -2444,7 +2441,6 @@ namespace Yavsc.Migrations
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PaymentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PerformerId")
|
||||
@ -2890,9 +2886,7 @@ namespace Yavsc.Migrations
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile")
|
||||
.WithMany()
|
||||
@ -2947,9 +2941,7 @@ namespace Yavsc.Migrations
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile")
|
||||
.WithMany()
|
||||
@ -3285,9 +3277,7 @@ namespace Yavsc.Migrations
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile")
|
||||
.WithMany()
|
||||
@ -3347,9 +3337,7 @@ namespace Yavsc.Migrations
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Workflow.PerformerProfile", "PerformerProfile")
|
||||
.WithMany()
|
||||
|
@ -39,16 +39,7 @@ namespace Yavsc.Models
|
||||
using System.Configuration;
|
||||
|
||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
{
|
||||
private readonly ILogger<ApplicationDbContext> logger;
|
||||
|
||||
|
||||
public ApplicationDbContext(ILoggerFactory loggerFactory,
|
||||
DbContextOptions<ApplicationDbContext> options) : base(options)
|
||||
{
|
||||
logger = loggerFactory.CreateLogger<ApplicationDbContext>();
|
||||
}
|
||||
|
||||
{
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
@ -89,7 +80,13 @@ namespace Yavsc.Models
|
||||
builder.Entity<Activity>().Property(a => a.ParentCode).IsRequired(false);
|
||||
// builder.Entity<IdentityUserLogin<String>>().HasKey(i=> new { i.LoginProvider, i.UserId, i.ProviderKey });
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
string? envCxStr = Environment.GetEnvironmentVariable(Constants.YavscConnectionStringEnvName);
|
||||
if (envCxStr != null)
|
||||
optionsBuilder.UseNpgsql(envCxStr);
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public DbSet<Client> Applications { get; set; }
|
||||
|
||||
public DbSet<RefreshToken> RefreshTokens { get; set; }
|
||||
|
@ -98,7 +98,7 @@ namespace Yavsc.Models.Billing
|
||||
|
||||
[ForeignKey("Regularisation")]
|
||||
|
||||
public string PaymentId { get; set; }
|
||||
public string? PaymentId { get; set; }
|
||||
|
||||
[Display(Name = "Acquittement de la facture")]
|
||||
public virtual PayPalPayment Regularisation { get; set; }
|
||||
|
@ -40,8 +40,10 @@ namespace yavscTests
|
||||
[Fact]
|
||||
public void GitClone()
|
||||
{
|
||||
Assert.NotNull (_serverFixture.DbContext.Project);
|
||||
var firstProject = _serverFixture.DbContext.Project.Include(p=>p.Repository).FirstOrDefault();
|
||||
using var scope = _serverFixture.Services.CreateScope();
|
||||
var dbContext = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||
Assert.NotNull (dbContext.Project);
|
||||
var firstProject = dbContext.Project.Include(p=>p.Repository).FirstOrDefault();
|
||||
Assert.NotNull (firstProject);
|
||||
var di = new DirectoryInfo(_serverFixture.SiteSettings.GitRepository);
|
||||
if (!di.Exists) di.Create();
|
||||
|
@ -16,6 +16,7 @@ using Yavsc.Services;
|
||||
using yavscTests.Settings;
|
||||
using Yavsc.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
|
||||
|
||||
namespace isnd.tests
|
||||
{
|
||||
@ -32,6 +33,7 @@ namespace isnd.tests
|
||||
|
||||
private WebApplication app;
|
||||
|
||||
public IServiceProvider Services { get; private set; }
|
||||
public string TestingUserName { get; private set; }
|
||||
public string ProtectedTestingApiKey { get; internal set; }
|
||||
public ApplicationUser TestingUser { get; private set; }
|
||||
@ -39,7 +41,6 @@ namespace isnd.tests
|
||||
public SiteSettings SiteSettings { get => siteSettings; set => siteSettings = value; }
|
||||
public MailSender MailSender { get; internal set; }
|
||||
public TestingSetup? TestingSetup { get; internal set; }
|
||||
public ApplicationDbContext DbContext { get; internal set; }
|
||||
|
||||
public WebServerFixture()
|
||||
{
|
||||
@ -63,6 +64,7 @@ namespace isnd.tests
|
||||
.Build();
|
||||
|
||||
this.app = builder.ConfigureWebAppServices();
|
||||
Services = app.Services;
|
||||
using (var migrationScope = app.Services.CreateScope())
|
||||
{
|
||||
var db = migrationScope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||
@ -114,7 +116,9 @@ namespace isnd.tests
|
||||
|
||||
TestingUser = new ApplicationUser
|
||||
{
|
||||
UserName = testingUserName
|
||||
UserName = testingUserName,
|
||||
Email = testingUserName + "@example.com",
|
||||
EmailConfirmed = true
|
||||
};
|
||||
|
||||
var result = userManager.CreateAsync(TestingUser).Result;
|
||||
|
Reference in New Issue
Block a user