Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: at created at columns to issues and feedback #46

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/src/MethodConf.Cms/Domain/Issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ public class Issue

[MaxLength(255)]
public string? PhoneNumber { get; set; }

public DateTime CreatedAt { get; set; }
}
2 changes: 2 additions & 0 deletions backend/src/MethodConf.Cms/Domain/SessionFeedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ public class SessionFeedback

[MaxLength(255)]
public string? Email { get; set; }

public DateTime CreatedAt { get; set; }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MethodConf.Cms.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddCreatedAt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "SessionFeedback",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "Issues",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "SessionFeedback");

migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Issues");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<Guid>("ConferenceId")
.HasColumnType("TEXT");

b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");

b.Property<string>("Email")
.HasMaxLength(255)
.HasColumnType("TEXT");
Expand Down Expand Up @@ -65,6 +68,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<int>("ContentRating")
.HasColumnType("INTEGER");

b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");

b.Property<string>("Email")
.HasMaxLength(255)
.HasColumnType("TEXT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public async Task<Result<IssueWithResponse>> CreateIssue(Guid conferenceId, Crea

var newIssue = mapper.Map<Issue>(createIssue);
newIssue.ConferenceId = conference.Key;
newIssue.CreatedAt = DateTime.UtcNow;

dbContext.Add(newIssue);
await dbContext.SaveChangesAsync();
Expand Down
2 changes: 2 additions & 0 deletions backend/src/MethodConf.Cms/Services/SessionFeedbackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public async Task<Result<SessionFeedback>> Create(Guid sessionId, CreateSessionF

var sessionFeedback = mapper.Map<SessionFeedback>(createSessionFeedback);
sessionFeedback.SessionId = session.Key;
sessionFeedback.CreatedAt = DateTime.UtcNow;


dbContext.SessionFeedback.Add(sessionFeedback);
await dbContext.SaveChangesAsync();
Expand Down