Files
marechai/Marechai.Database/Migrations/20260514233505_AddUserMessageNotificationPreferenceAndLastLanguage.cs
Natalia Portillo 1a54709914 Add email notification for new messages
- Introduced NewMessageEmail.cshtml and NewMessageEmailModel.cs for email template and model.
- Implemented endpoints in AuthController for retrieving and updating user notification preferences.
- Enhanced MessagesController to queue email notifications for new messages.
- Added LastLanguageCaptureMiddleware to capture user's language preferences.
- Created MessageNotificationQueue and MessageNotificationWorker to handle email sending in the background.
- Updated Profile.razor and Profile.razor.cs to manage notification preferences in the user profile.
- Localized new strings for notification preferences in multiple languages.
- Updated AuthService to handle fetching and updating notification preferences.
- Modified HttpAuthHandler to forward user's current UI culture for localization.
2026-05-15 01:02:21 +01:00

44 lines
1.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marechai.Database.Migrations
{
/// <inheritdoc />
public partial class AddUserMessageNotificationPreferenceAndLastLanguage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LastLanguageVisited",
table: "AspNetUsers",
type: "varchar(10)",
maxLength: 10,
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
// Default to TRUE so existing accounts opt in to notifications when the column is added,
// matching the C# property initialiser used by RegisterAsync for new accounts.
migrationBuilder.AddColumn<bool>(
name: "NotifyOnNewMessage",
table: "AspNetUsers",
type: "bit(1)",
nullable: false,
defaultValue: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LastLanguageVisited",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "NotifyOnNewMessage",
table: "AspNetUsers");
}
}
}