add architecture skeleton
This commit is contained in:
@@ -0,0 +1,326 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GymLogAI.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GymLogAI.Persistence.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260419100551_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Exercise", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.PrimitiveCollection<float[]>("Embedding")
|
||||
.HasColumnType("real[]");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("exercises", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.ExerciseSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal?>("DistanceMeters")
|
||||
.HasPrecision(10, 2)
|
||||
.HasColumnType("numeric(10,2)");
|
||||
|
||||
b.Property<int?>("DurationSeconds")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
|
||||
b.Property<int>("Order")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("Repetitions")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal?>("WeightKg")
|
||||
.HasPrecision(8, 2)
|
||||
.HasColumnType("numeric(8,2)");
|
||||
|
||||
b.Property<Guid>("WorkoutExerciseId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkoutExerciseId", "Order")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("exercise_sets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.TelegramMessage", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ImportedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("ParsedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ParsingError")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.Property<int>("ParsingStatus")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("SentAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("TelegramChatId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("TelegramMessageId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("WorkoutId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TelegramChatId", "TelegramMessageId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId", "ParsingStatus");
|
||||
|
||||
b.ToTable("telegram_messages", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<long>("TelegramUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TelegramUserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Workout", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<DateTime>("PerformedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("SourceTelegramMessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("SourceType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SourceTelegramMessageId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId", "PerformedAtUtc");
|
||||
|
||||
b.ToTable("workouts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.WorkoutExercise", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ExerciseId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.Property<int>("Order")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("WorkoutId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExerciseId");
|
||||
|
||||
b.HasIndex("WorkoutId", "Order")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("workout_exercises", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.ExerciseSet", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.WorkoutExercise", "WorkoutExercise")
|
||||
.WithMany("Sets")
|
||||
.HasForeignKey("WorkoutExerciseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WorkoutExercise");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.TelegramMessage", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.User", "User")
|
||||
.WithMany("TelegramMessages")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Workout", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.TelegramMessage", "SourceTelegramMessage")
|
||||
.WithOne("Workout")
|
||||
.HasForeignKey("GymLogAI.Core.Entities.Workout", "SourceTelegramMessageId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("GymLogAI.Core.Entities.User", "User")
|
||||
.WithMany("Workouts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SourceTelegramMessage");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.WorkoutExercise", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.Exercise", "Exercise")
|
||||
.WithMany("WorkoutExercises")
|
||||
.HasForeignKey("ExerciseId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GymLogAI.Core.Entities.Workout", "Workout")
|
||||
.WithMany("WorkoutExercises")
|
||||
.HasForeignKey("WorkoutId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Exercise");
|
||||
|
||||
b.Navigation("Workout");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Exercise", b =>
|
||||
{
|
||||
b.Navigation("WorkoutExercises");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.TelegramMessage", b =>
|
||||
{
|
||||
b.Navigation("Workout");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.User", b =>
|
||||
{
|
||||
b.Navigation("TelegramMessages");
|
||||
|
||||
b.Navigation("Workouts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Workout", b =>
|
||||
{
|
||||
b.Navigation("WorkoutExercises");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.WorkoutExercise", b =>
|
||||
{
|
||||
b.Navigation("Sets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GymLogAI.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "exercises",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
|
||||
Embedding = table.Column<float[]>(type: "real[]", nullable: true),
|
||||
CreatedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_exercises", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
TelegramUserId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Username = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||
FirstName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||
LastName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||
CreatedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "telegram_messages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
TelegramChatId = table.Column<long>(type: "bigint", nullable: false),
|
||||
TelegramMessageId = table.Column<int>(type: "integer", nullable: false),
|
||||
Text = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
|
||||
SentAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ImportedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ParsingStatus = table.Column<int>(type: "integer", nullable: false),
|
||||
ParsingError = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
|
||||
WorkoutId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
ParsedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_telegram_messages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_telegram_messages_users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "workouts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
SourceTelegramMessageId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
PerformedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Title = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
Notes = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: true),
|
||||
SourceType = table.Column<int>(type: "integer", nullable: false),
|
||||
CreatedAtUtc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_workouts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_workouts_telegram_messages_SourceTelegramMessageId",
|
||||
column: x => x.SourceTelegramMessageId,
|
||||
principalTable: "telegram_messages",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_workouts_users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "workout_exercises",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
WorkoutId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ExerciseId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Order = table.Column<int>(type: "integer", nullable: false),
|
||||
Notes = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_workout_exercises", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_workout_exercises_exercises_ExerciseId",
|
||||
column: x => x.ExerciseId,
|
||||
principalTable: "exercises",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_workout_exercises_workouts_WorkoutId",
|
||||
column: x => x.WorkoutId,
|
||||
principalTable: "workouts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "exercise_sets",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
WorkoutExerciseId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Order = table.Column<int>(type: "integer", nullable: false),
|
||||
WeightKg = table.Column<decimal>(type: "numeric(8,2)", precision: 8, scale: 2, nullable: true),
|
||||
Repetitions = table.Column<int>(type: "integer", nullable: true),
|
||||
DurationSeconds = table.Column<int>(type: "integer", nullable: true),
|
||||
DistanceMeters = table.Column<decimal>(type: "numeric(10,2)", precision: 10, scale: 2, nullable: true),
|
||||
Notes = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_exercise_sets", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_exercise_sets_workout_exercises_WorkoutExerciseId",
|
||||
column: x => x.WorkoutExerciseId,
|
||||
principalTable: "workout_exercises",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_exercise_sets_WorkoutExerciseId_Order",
|
||||
table: "exercise_sets",
|
||||
columns: new[] { "WorkoutExerciseId", "Order" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_exercises_Name",
|
||||
table: "exercises",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_telegram_messages_TelegramChatId_TelegramMessageId",
|
||||
table: "telegram_messages",
|
||||
columns: new[] { "TelegramChatId", "TelegramMessageId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_telegram_messages_UserId_ParsingStatus",
|
||||
table: "telegram_messages",
|
||||
columns: new[] { "UserId", "ParsingStatus" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_users_TelegramUserId",
|
||||
table: "users",
|
||||
column: "TelegramUserId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_workout_exercises_ExerciseId",
|
||||
table: "workout_exercises",
|
||||
column: "ExerciseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_workout_exercises_WorkoutId_Order",
|
||||
table: "workout_exercises",
|
||||
columns: new[] { "WorkoutId", "Order" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_workouts_SourceTelegramMessageId",
|
||||
table: "workouts",
|
||||
column: "SourceTelegramMessageId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_workouts_UserId_PerformedAtUtc",
|
||||
table: "workouts",
|
||||
columns: new[] { "UserId", "PerformedAtUtc" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "exercise_sets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "workout_exercises");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "exercises");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "workouts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "telegram_messages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GymLogAI.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GymLogAI.Persistence.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Exercise", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.PrimitiveCollection<float[]>("Embedding")
|
||||
.HasColumnType("real[]");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("exercises", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.ExerciseSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<decimal?>("DistanceMeters")
|
||||
.HasPrecision(10, 2)
|
||||
.HasColumnType("numeric(10,2)");
|
||||
|
||||
b.Property<int?>("DurationSeconds")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)");
|
||||
|
||||
b.Property<int>("Order")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("Repetitions")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal?>("WeightKg")
|
||||
.HasPrecision(8, 2)
|
||||
.HasColumnType("numeric(8,2)");
|
||||
|
||||
b.Property<Guid>("WorkoutExerciseId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkoutExerciseId", "Order")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("exercise_sets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.TelegramMessage", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ImportedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("ParsedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ParsingError")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.Property<int>("ParsingStatus")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("SentAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("TelegramChatId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("TelegramMessageId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("WorkoutId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TelegramChatId", "TelegramMessageId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId", "ParsingStatus");
|
||||
|
||||
b.ToTable("telegram_messages", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<long>("TelegramUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TelegramUserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Workout", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<DateTime>("PerformedAtUtc")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("SourceTelegramMessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("SourceType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SourceTelegramMessageId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId", "PerformedAtUtc");
|
||||
|
||||
b.ToTable("workouts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.WorkoutExercise", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ExerciseId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.Property<int>("Order")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("WorkoutId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExerciseId");
|
||||
|
||||
b.HasIndex("WorkoutId", "Order")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("workout_exercises", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.ExerciseSet", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.WorkoutExercise", "WorkoutExercise")
|
||||
.WithMany("Sets")
|
||||
.HasForeignKey("WorkoutExerciseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WorkoutExercise");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.TelegramMessage", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.User", "User")
|
||||
.WithMany("TelegramMessages")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Workout", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.TelegramMessage", "SourceTelegramMessage")
|
||||
.WithOne("Workout")
|
||||
.HasForeignKey("GymLogAI.Core.Entities.Workout", "SourceTelegramMessageId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("GymLogAI.Core.Entities.User", "User")
|
||||
.WithMany("Workouts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SourceTelegramMessage");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.WorkoutExercise", b =>
|
||||
{
|
||||
b.HasOne("GymLogAI.Core.Entities.Exercise", "Exercise")
|
||||
.WithMany("WorkoutExercises")
|
||||
.HasForeignKey("ExerciseId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GymLogAI.Core.Entities.Workout", "Workout")
|
||||
.WithMany("WorkoutExercises")
|
||||
.HasForeignKey("WorkoutId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Exercise");
|
||||
|
||||
b.Navigation("Workout");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Exercise", b =>
|
||||
{
|
||||
b.Navigation("WorkoutExercises");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.TelegramMessage", b =>
|
||||
{
|
||||
b.Navigation("Workout");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.User", b =>
|
||||
{
|
||||
b.Navigation("TelegramMessages");
|
||||
|
||||
b.Navigation("Workouts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.Workout", b =>
|
||||
{
|
||||
b.Navigation("WorkoutExercises");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GymLogAI.Core.Entities.WorkoutExercise", b =>
|
||||
{
|
||||
b.Navigation("Sets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user