source: ChapterX.Infrastructure/DependencyInjection.cs@ a7550ca

main
Last change on this file since a7550ca was e294f7d, checked in by kikisrbinoska <srbinoskakristina07@…>, 4 months ago

Added JWT authentication

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[877c13c]1using ChapterX.Application.Abstractions;
[e294f7d]2using ChapterX.Application.Auth;
[877c13c]3using ChapterX.Domain.Repositories;
4using ChapterX.Infrastructure.Data.DataContext;
5using ChapterX.Infrastructure.Repositories;
[e294f7d]6using ChapterX.Infrastructure.Services;
[877c13c]7using Microsoft.EntityFrameworkCore;
8using Microsoft.Extensions.Configuration;
9using Microsoft.Extensions.DependencyInjection;
10
11namespace ChapterX.Infrastructure
12{
13 public static class DependencyInjection
14 {
15 public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
16 {
17 services.AddDbContext<ApplicationDbContext>(options =>
18 options.UseNpgsql(configuration.GetConnectionString("Database")));
19
20 services.AddScoped<IApplicationDbContext>(sp => sp.GetRequiredService<ApplicationDbContext>());
[e294f7d]21 services.AddScoped<IJwtTokenService, JwtTokenService>();
[877c13c]22
23 services.AddScoped<IUserRepository, UserRepository>();
24 services.AddScoped<IWriterRepository, WriterRepository>();
25 services.AddScoped<IStoryRepository, StoryRepository>();
26 services.AddScoped<IAdminRepository, AdminRepository>();
27 services.AddScoped<IRegularUserRepository, RegularUserRepository>();
28 services.AddScoped<IGenreRepository, GenreRepository>();
29 services.AddScoped<IReadingListRepository, ReadingListRepository>();
30 services.AddScoped<IReadingListItemsRepository, ReadingListItemsRepository>();
31 services.AddScoped<INotificationRepository, NotificationRepository>();
32 services.AddScoped<INotifyRepository, NotifyRepository>();
33 services.AddScoped<INeedApprovalRepository, NeedApprovalRepository>();
34 services.AddScoped<ILikesRepository, LikesRepository>();
35 services.AddScoped<IHasGenreRepository, HasGenreRepository>();
36 services.AddScoped<ICollaborationRepository, CollaborationRepository>();
37 services.AddScoped<IChapterRepository, ChapterRepository>();
38 services.AddScoped<ICommentRepository, CommentRepository>();
39 services.AddScoped<IAISuggestionRepository, AISuggestionRepository>();
40 services.AddScoped<IContentTypeRepository, ContentTypeRepository>();
41 services.AddScoped<IPermissionLevelRepository, PermissionLevelRepository>();
42 services.AddScoped<IRolesRepository, RolesRepository>();
43 services.AddScoped<IStatusRepository, StatusRepository>();
44
45 return services;
46 }
47 }
48}
Note: See TracBrowser for help on using the repository browser.