Changeset b62cefc


Ignore:
Timestamp:
03/19/26 23:26:14 (4 months ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Children:
acf690c
Parents:
e294f7d
Message:

Added frontend and imporoved AI Suggestions service

Files:
70 added
6 edited

Legend:

Unmodified
Added
Removed
  • ChapterX.API/Program.cs

    re294f7d rb62cefc  
    77
    88var builder = WebApplication.CreateBuilder(args);
     9
     10builder.Services.AddCors(options =>
     11{
     12    options.AddPolicy("Frontend", policy =>
     13        policy.WithOrigins("http://localhost:5173", "https://localhost:5173")
     14              .AllowAnyHeader()
     15              .AllowAnyMethod());
     16});
    917
    1018builder.Services.AddControllers();
     
    6775
    6876app.UseHttpsRedirection();
     77app.UseCors("Frontend");
    6978app.UseAuthentication();
    7079app.UseAuthorization();
  • ChapterX.Application/AISuggestion/Commands/AddHandler.cs

    re294f7d rb62cefc  
    2323                SuggestedText = request.SuggestedText,
    2424                StoryId = request.StoryId,
    25                 Accepted = false,
     25                Accepted = null,
    2626                CreatedAt = DateTime.UtcNow
    2727            };
  • ChapterX.Application/AISuggestion/Commands/UpdateHandler.cs

    re294f7d rb62cefc  
    2525            suggestion.SuggestedText = request.SuggestedText;
    2626            suggestion.Accepted = request.Accepted;
    27             if (request.Accepted)
     27            if (request.Accepted == true)
    2828                suggestion.AppliedAt = DateTime.UtcNow;
    2929
  • ChapterX.Application/AISuggestion/Commands/UpdateRequest.cs

    re294f7d rb62cefc  
    77        string OriginalText,
    88        string SuggestedText,
    9         bool Accepted
     9        bool? Accepted
    1010    ) : IRequest<UpdateResponse>;
    1111}
  • ChapterX.Domain/Entities/AISuggestion.cs

    re294f7d rb62cefc  
    1313        public string OriginalText { get; set; } = string.Empty;
    1414        public string SuggestedText { get; set; } = string.Empty;
    15         public bool Accepted { get; set; }
     15        public bool? Accepted { get; set; }
    1616        public DateTime CreatedAt { get; set; }
    1717        public DateTime? AppliedAt { get; set; }
  • ChapterX.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs

    re294f7d rb62cefc  
    3131                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
    3232
    33                     b.Property<bool>("Accepted")
     33                    b.Property<bool?>("Accepted")
    3434                        .HasColumnType("boolean");
    3535
     
    5959                    b.HasIndex("StoryId");
    6060
    61                     b.ToTable("AISuggestions");
     61                    b.ToTable("AISuggestions", (string)null);
    6262                });
    6363
     
    7878                        .IsUnique();
    7979
    80                     b.ToTable("Admins");
     80                    b.ToTable("Admins", (string)null);
    8181                });
    8282
     
    129129                    b.HasIndex("StoryId");
    130130
    131                     b.ToTable("Chapters");
     131                    b.ToTable("Chapters", (string)null);
    132132                });
    133133
     
    159159                    b.HasIndex("UserId");
    160160
    161                     b.ToTable("Collaborations");
     161                    b.ToTable("Collaborations", (string)null);
    162162                });
    163163
     
    192192                    b.HasIndex("UserId");
    193193
    194                     b.ToTable("Comments");
     194                    b.ToTable("Comments", (string)null);
    195195                });
    196196
     
    209209                    b.HasKey("Id");
    210210
    211                     b.ToTable("Genres");
     211                    b.ToTable("Genres", (string)null);
    212212                });
    213213
     
    232232                    b.HasIndex("StoryId");
    233233
    234                     b.ToTable("HasGenres");
     234                    b.ToTable("HasGenres", (string)null);
    235235                });
    236236
     
    263263                    b.HasIndex("UserId");
    264264
    265                     b.ToTable("Likes");
     265                    b.ToTable("Likes", (string)null);
    266266                });
    267267
     
    302302                    b.HasIndex("StoryId");
    303303
    304                     b.ToTable("NeedApprovals");
     304                    b.ToTable("NeedApprovals", (string)null);
    305305                });
    306306
     
    329329                    b.HasKey("Id");
    330330
    331                     b.ToTable("Notifications");
     331                    b.ToTable("Notifications", (string)null);
    332332                });
    333333
     
    360360                    b.HasIndex("UserId");
    361361
    362                     b.ToTable("Notifies");
     362                    b.ToTable("Notifies", (string)null);
    363363                });
    364364
     
    394394                    b.HasIndex("UserId");
    395395
    396                     b.ToTable("ReadingLists");
     396                    b.ToTable("ReadingLists", (string)null);
    397397                });
    398398
     
    420420                    b.HasIndex("StoryId");
    421421
    422                     b.ToTable("ReadingListItems");
     422                    b.ToTable("ReadingListItems", (string)null);
    423423                });
    424424
     
    439439                        .IsUnique();
    440440
    441                     b.ToTable("RegularUsers");
     441                    b.ToTable("RegularUsers", (string)null);
    442442                });
    443443
     
    484484                    b.HasIndex("WriterId");
    485485
    486                     b.ToTable("Stories");
     486                    b.ToTable("Stories", (string)null);
    487487                });
    488488
     
    523523                    b.HasKey("Id");
    524524
    525                     b.ToTable("Users");
     525                    b.ToTable("Users", (string)null);
    526526                });
    527527
     
    546546                        .IsUnique();
    547547
    548                     b.ToTable("Writers");
     548                    b.ToTable("Writers", (string)null);
    549549                });
    550550
Note: See TracChangeset for help on using the changeset viewer.