source: ChapterX.Infrastructure/DependencyInjection.cs@ 7fbb91c

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

Added JWT authentication

  • Property mode set to 100644
File size: 2.5 KB
Line 
1using ChapterX.Application.Abstractions;
2using ChapterX.Application.Auth;
3using ChapterX.Domain.Repositories;
4using ChapterX.Infrastructure.Data.DataContext;
5using ChapterX.Infrastructure.Repositories;
6using ChapterX.Infrastructure.Services;
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>());
21 services.AddScoped<IJwtTokenService, JwtTokenService>();
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.