From f52e374d6748631785c290163b5cbc181a409406 Mon Sep 17 00:00:00 2001 From: Simona Zgarcea Date: Sun, 12 Sep 2021 19:07:20 +0300 Subject: [PATCH 1/5] adding user for lesson save --- .../GraphQL/Resolvers/LessonSaveResolver.cs | 55 ++++++++++--------- .../GraphQL/TeacherWorkoutMutation.cs | 7 ++- TeacherWorkout.Api/Startup.cs | 5 +- .../Repositories/LessonRepository.cs | 7 ++- .../Lessons/ILessonRepository.cs | 4 ++ .../Lessons/ILessonStatusRepository.cs | 1 + TeacherWorkout.Domain/Models/LessonStaus.cs | 2 + .../Repositories/LessonRepository.cs | 29 ++++++++++ .../Repositories/LessonStatusRepository.cs | 5 ++ 9 files changed, 83 insertions(+), 32 deletions(-) diff --git a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs index 1f5354c..ea93120 100644 --- a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs +++ b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs @@ -1,3 +1,5 @@ +using TeacherWorkout.Domain.Common; +using TeacherWorkout.Domain.Lessons; using TeacherWorkout.Domain.Models; using TeacherWorkout.Domain.Models.Inputs; using TeacherWorkout.Domain.Models.Payloads; @@ -5,40 +7,39 @@ namespace TeacherWorkout.Api.GraphQL.Resolvers { - public static class LessonSaveResolver + public class LessonSaveResolver : IOperation { - public static LessonSavePayload Resolve(LessonSaveInput lessonSave) + + private IContext _context; + private ILessonStatusRepository _lessonStatusRepository; + private ILessonRepository _lessonRepository; + + public LessonSaveResolver (IContext context, ILessonStatusRepository lessonStatusRepository, ILessonRepository lessonRepository) { - return new() {Lesson = MockData(lessonSave)}; + _context = context; + _lessonStatusRepository = lessonStatusRepository; + _lessonRepository = lessonRepository; + } - private static Lesson MockData(LessonSaveInput lessonSave) + public LessonSavePayload Execute(LessonSaveInput input) { - return new() + Lesson lesson = _lessonRepository.Find(input.LessonId); + + _lessonStatusRepository.Insert(new LessonStatus() { - Id = lessonSave.LessonId, - Title = "Lorem Ipsum", - Thumbnail = new Image - { - Description = "For Challenged People", - Url = "https://example.com" - }, - Theme = new Theme - { - Id = "1", - Title = "Lorem Ipsum", - Thumbnail = new Image - { - Description = "For Challenged People", - Url = "https://example.com" - } - }, - Duration = new Duration - { - Value = 45, - Unit = DurationUnit.Minutes - } + Lesson = lesson, + PercentCompleted = 0, + User = _context.CurentUser + }); + + return new LessonSavePayload() + { + Lesson = lesson }; } + + + } } \ No newline at end of file diff --git a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs index 2246a37..e9126b8 100644 --- a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +++ b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs @@ -9,10 +9,10 @@ namespace TeacherWorkout.Api.GraphQL { public class TeacherWorkoutMutation : ObjectGraphType { - public TeacherWorkoutMutation() + public TeacherWorkoutMutation(LessonSaveResolver lessonSaveResolver) { Name = "Mutation"; - + Field>( "lessonSave", arguments: new QueryArguments( @@ -21,7 +21,8 @@ public TeacherWorkoutMutation() resolve: context => { var lessonSave = context.GetArgument("input"); - return LessonSaveResolver.Resolve(lessonSave); + + return lessonSaveResolver.Execute(lessonSave); }); } } diff --git a/TeacherWorkout.Api/Startup.cs b/TeacherWorkout.Api/Startup.cs index 4509059..eac332f 100644 --- a/TeacherWorkout.Api/Startup.cs +++ b/TeacherWorkout.Api/Startup.cs @@ -13,6 +13,7 @@ using TeacherWorkout.Api.GraphQL; using TeacherWorkout.Data; using TeacherWorkout.Domain.Common; +using TeacherWorkout.Domain.Models; namespace TeacherWorkout.Api { @@ -28,7 +29,7 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { EnsureReferencedAssembliesAreLoaded(); - + services.AddCors(options => { options.AddDefaultPolicy(builder => @@ -57,6 +58,8 @@ public void ConfigureServices(IServiceCollection services) services.AddDbContext(options => options.UseNpgsql(Configuration.GetConnectionString("TeacherWorkoutContext"))); + + services.AddSingleton(new Context() { CurentUser = new User() { Id = "1", Name = "Test user" }}); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/TeacherWorkout.Data/Repositories/LessonRepository.cs b/TeacherWorkout.Data/Repositories/LessonRepository.cs index dadc8d9..e78f831 100644 --- a/TeacherWorkout.Data/Repositories/LessonRepository.cs +++ b/TeacherWorkout.Data/Repositories/LessonRepository.cs @@ -14,7 +14,12 @@ public LessonRepository(TeacherWorkoutContext context) { _context = context; } - + + public Lesson Find(string ID) + { + return _context.Lessons.Find(ID); + } + public PaginatedResult PaginatedList(LessonFilter filter) { var result = _context.Lessons.AsQueryable() diff --git a/TeacherWorkout.Domain/Lessons/ILessonRepository.cs b/TeacherWorkout.Domain/Lessons/ILessonRepository.cs index 94f63af..b95c5c5 100644 --- a/TeacherWorkout.Domain/Lessons/ILessonRepository.cs +++ b/TeacherWorkout.Domain/Lessons/ILessonRepository.cs @@ -6,5 +6,9 @@ namespace TeacherWorkout.Domain.Lessons public interface ILessonRepository { PaginatedResult PaginatedList(LessonFilter filter); + + Lesson Find(string ID); + } + } \ No newline at end of file diff --git a/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs b/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs index 75a0345..6a85bd0 100644 --- a/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs +++ b/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs @@ -6,5 +6,6 @@ namespace TeacherWorkout.Domain.Lessons public interface ILessonStatusRepository { IEnumerable List(LessonStatusFilter filter); + LessonStatus Insert(LessonStatus lessonStatus); } } \ No newline at end of file diff --git a/TeacherWorkout.Domain/Models/LessonStaus.cs b/TeacherWorkout.Domain/Models/LessonStaus.cs index 7f5db7c..26a5551 100644 --- a/TeacherWorkout.Domain/Models/LessonStaus.cs +++ b/TeacherWorkout.Domain/Models/LessonStaus.cs @@ -7,5 +7,7 @@ public class LessonStatus public int PercentCompleted { get; set; } public ILessonStep CurrentLessonStep { get; set; } + + public User User { get; set; } } } \ No newline at end of file diff --git a/TeacherWorkout.MockData/Repositories/LessonRepository.cs b/TeacherWorkout.MockData/Repositories/LessonRepository.cs index 18a8654..34d8d70 100644 --- a/TeacherWorkout.MockData/Repositories/LessonRepository.cs +++ b/TeacherWorkout.MockData/Repositories/LessonRepository.cs @@ -7,6 +7,35 @@ namespace TeacherWorkout.MockData.Repositories { public class LessonRepository : ILessonRepository { + public Lesson Find(string ID) + { + return new() + { + Id = "2", + Title = "Dolor sit amet", + Thumbnail = new Image + { + Description = "Another Cat Photo", + Url = "https://static.toiimg.com/thumb/msid-67586673,width-800,height-600,resizemode-75,imgsize-3918697,pt-32,y_pad-40/67586673.jpg" + }, + Theme = new Theme + { + Id = "1", + Title = "Lorem Ipsum", + Thumbnail = new Image + { + Description = "Cat Photo", + Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg" + } + }, + Duration = new Duration + { + Value = 32, + Unit = DurationUnit.Minutes + } + }; + } + public PaginatedResult PaginatedList(LessonFilter filter) { return new() diff --git a/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs b/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs index f1d1ce4..0a231eb 100644 --- a/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs +++ b/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs @@ -7,6 +7,11 @@ namespace TeacherWorkout.MockData.Repositories { public class LessonStatusRepository : ILessonStatusRepository { + public LessonStatus Insert(LessonStatus lessonStatus) + { + return lessonStatus; + } + public IEnumerable List(LessonStatusFilter filter) { return filter.LessonIds From 9a5ca598b88a8184cc7da61dc815aaf1d7916b2a Mon Sep 17 00:00:00 2001 From: Simona Zgarcea Date: Sun, 26 Sep 2021 11:40:52 +0300 Subject: [PATCH 2/5] merge --- .../GraphQL/Resolvers/LessonSaveResolver.cs | 55 ++++++++++--------- .../GraphQL/TeacherWorkoutMutation.cs | 5 +- TeacherWorkout.Api/Startup.cs | 5 +- .../Repositories/LessonRepository.cs | 7 ++- .../Lessons/ILessonRepository.cs | 4 ++ .../Lessons/ILessonStatusRepository.cs | 1 + TeacherWorkout.Domain/Models/LessonStaus.cs | 2 + .../Repositories/LessonRepository.cs | 29 ++++++++++ .../Repositories/LessonStatusRepository.cs | 5 ++ 9 files changed, 82 insertions(+), 31 deletions(-) diff --git a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs index 1f5354c..ea93120 100644 --- a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs +++ b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs @@ -1,3 +1,5 @@ +using TeacherWorkout.Domain.Common; +using TeacherWorkout.Domain.Lessons; using TeacherWorkout.Domain.Models; using TeacherWorkout.Domain.Models.Inputs; using TeacherWorkout.Domain.Models.Payloads; @@ -5,40 +7,39 @@ namespace TeacherWorkout.Api.GraphQL.Resolvers { - public static class LessonSaveResolver + public class LessonSaveResolver : IOperation { - public static LessonSavePayload Resolve(LessonSaveInput lessonSave) + + private IContext _context; + private ILessonStatusRepository _lessonStatusRepository; + private ILessonRepository _lessonRepository; + + public LessonSaveResolver (IContext context, ILessonStatusRepository lessonStatusRepository, ILessonRepository lessonRepository) { - return new() {Lesson = MockData(lessonSave)}; + _context = context; + _lessonStatusRepository = lessonStatusRepository; + _lessonRepository = lessonRepository; + } - private static Lesson MockData(LessonSaveInput lessonSave) + public LessonSavePayload Execute(LessonSaveInput input) { - return new() + Lesson lesson = _lessonRepository.Find(input.LessonId); + + _lessonStatusRepository.Insert(new LessonStatus() { - Id = lessonSave.LessonId, - Title = "Lorem Ipsum", - Thumbnail = new Image - { - Description = "For Challenged People", - Url = "https://example.com" - }, - Theme = new Theme - { - Id = "1", - Title = "Lorem Ipsum", - Thumbnail = new Image - { - Description = "For Challenged People", - Url = "https://example.com" - } - }, - Duration = new Duration - { - Value = 45, - Unit = DurationUnit.Minutes - } + Lesson = lesson, + PercentCompleted = 0, + User = _context.CurentUser + }); + + return new LessonSavePayload() + { + Lesson = lesson }; } + + + } } \ No newline at end of file diff --git a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs index ad78c34..4c07b2d 100644 --- a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +++ b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs @@ -13,7 +13,7 @@ public class TeacherWorkoutMutation : ObjectGraphType public TeacherWorkoutMutation(CompleteStep completeStep) { Name = "Mutation"; - + Field>( "lessonSave", arguments: new QueryArguments( @@ -22,7 +22,8 @@ public TeacherWorkoutMutation(CompleteStep completeStep) resolve: context => { var lessonSave = context.GetArgument("input"); - return LessonSaveResolver.Resolve(lessonSave); + + return lessonSaveResolver.Execute(lessonSave); }); Field( diff --git a/TeacherWorkout.Api/Startup.cs b/TeacherWorkout.Api/Startup.cs index 4509059..eac332f 100644 --- a/TeacherWorkout.Api/Startup.cs +++ b/TeacherWorkout.Api/Startup.cs @@ -13,6 +13,7 @@ using TeacherWorkout.Api.GraphQL; using TeacherWorkout.Data; using TeacherWorkout.Domain.Common; +using TeacherWorkout.Domain.Models; namespace TeacherWorkout.Api { @@ -28,7 +29,7 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { EnsureReferencedAssembliesAreLoaded(); - + services.AddCors(options => { options.AddDefaultPolicy(builder => @@ -57,6 +58,8 @@ public void ConfigureServices(IServiceCollection services) services.AddDbContext(options => options.UseNpgsql(Configuration.GetConnectionString("TeacherWorkoutContext"))); + + services.AddSingleton(new Context() { CurentUser = new User() { Id = "1", Name = "Test user" }}); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/TeacherWorkout.Data/Repositories/LessonRepository.cs b/TeacherWorkout.Data/Repositories/LessonRepository.cs index dadc8d9..e78f831 100644 --- a/TeacherWorkout.Data/Repositories/LessonRepository.cs +++ b/TeacherWorkout.Data/Repositories/LessonRepository.cs @@ -14,7 +14,12 @@ public LessonRepository(TeacherWorkoutContext context) { _context = context; } - + + public Lesson Find(string ID) + { + return _context.Lessons.Find(ID); + } + public PaginatedResult PaginatedList(LessonFilter filter) { var result = _context.Lessons.AsQueryable() diff --git a/TeacherWorkout.Domain/Lessons/ILessonRepository.cs b/TeacherWorkout.Domain/Lessons/ILessonRepository.cs index 94f63af..b95c5c5 100644 --- a/TeacherWorkout.Domain/Lessons/ILessonRepository.cs +++ b/TeacherWorkout.Domain/Lessons/ILessonRepository.cs @@ -6,5 +6,9 @@ namespace TeacherWorkout.Domain.Lessons public interface ILessonRepository { PaginatedResult PaginatedList(LessonFilter filter); + + Lesson Find(string ID); + } + } \ No newline at end of file diff --git a/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs b/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs index 75a0345..6a85bd0 100644 --- a/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs +++ b/TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs @@ -6,5 +6,6 @@ namespace TeacherWorkout.Domain.Lessons public interface ILessonStatusRepository { IEnumerable List(LessonStatusFilter filter); + LessonStatus Insert(LessonStatus lessonStatus); } } \ No newline at end of file diff --git a/TeacherWorkout.Domain/Models/LessonStaus.cs b/TeacherWorkout.Domain/Models/LessonStaus.cs index 7f5db7c..26a5551 100644 --- a/TeacherWorkout.Domain/Models/LessonStaus.cs +++ b/TeacherWorkout.Domain/Models/LessonStaus.cs @@ -7,5 +7,7 @@ public class LessonStatus public int PercentCompleted { get; set; } public ILessonStep CurrentLessonStep { get; set; } + + public User User { get; set; } } } \ No newline at end of file diff --git a/TeacherWorkout.MockData/Repositories/LessonRepository.cs b/TeacherWorkout.MockData/Repositories/LessonRepository.cs index 18a8654..34d8d70 100644 --- a/TeacherWorkout.MockData/Repositories/LessonRepository.cs +++ b/TeacherWorkout.MockData/Repositories/LessonRepository.cs @@ -7,6 +7,35 @@ namespace TeacherWorkout.MockData.Repositories { public class LessonRepository : ILessonRepository { + public Lesson Find(string ID) + { + return new() + { + Id = "2", + Title = "Dolor sit amet", + Thumbnail = new Image + { + Description = "Another Cat Photo", + Url = "https://static.toiimg.com/thumb/msid-67586673,width-800,height-600,resizemode-75,imgsize-3918697,pt-32,y_pad-40/67586673.jpg" + }, + Theme = new Theme + { + Id = "1", + Title = "Lorem Ipsum", + Thumbnail = new Image + { + Description = "Cat Photo", + Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg" + } + }, + Duration = new Duration + { + Value = 32, + Unit = DurationUnit.Minutes + } + }; + } + public PaginatedResult PaginatedList(LessonFilter filter) { return new() diff --git a/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs b/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs index f1d1ce4..0a231eb 100644 --- a/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs +++ b/TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs @@ -7,6 +7,11 @@ namespace TeacherWorkout.MockData.Repositories { public class LessonStatusRepository : ILessonStatusRepository { + public LessonStatus Insert(LessonStatus lessonStatus) + { + return lessonStatus; + } + public IEnumerable List(LessonStatusFilter filter) { return filter.LessonIds From a524889d16a1c596cf9a4b0b2cbe76d586a376e5 Mon Sep 17 00:00:00 2001 From: Simona Zgarcea Date: Sun, 26 Sep 2021 11:41:20 +0300 Subject: [PATCH 3/5] merge --- .../GraphQL/TeacherWorkoutMutation.cs | 2 +- stop | 321 ++++++++++++++++++ 2 files changed, 322 insertions(+), 1 deletion(-) create mode 100644 stop diff --git a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs index 4c07b2d..10a7718 100644 --- a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +++ b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs @@ -10,7 +10,7 @@ namespace TeacherWorkout.Api.GraphQL { public class TeacherWorkoutMutation : ObjectGraphType { - public TeacherWorkoutMutation(CompleteStep completeStep) + public TeacherWorkoutMutation(CompleteStep completeStep, LessonSaveResolver lessonSaveResolver) { Name = "Mutation"; diff --git a/stop b/stop new file mode 100644 index 0000000..269ee7f --- /dev/null +++ b/stop @@ -0,0 +1,321 @@ +commit 3816789720d5d8ba9778ae598b34e2cc7379a5a9 (HEAD -> develop) +Author: Simona Zgarcea +Date: Sun Sep 12 16:49:49 2021 +0300 + + adding user for LessonSave + +:000000 100644 0000000 4644a90 A TeacherWorkout.Domain/Common/IUser.cs +:000000 100644 0000000 1463a82 A TeacherWorkout.Domain/Models/User.cs + +commit ac2be249b0c0ef9233e42ce21e0a9176918d4d2f (lessonSave) +Author: Doru Pirvu +Date: Fri Aug 27 15:00:51 2021 +0300 + + [feature/12] Add lessons query (#45) + + * Add Domain project with Themes and Lessons + + * Implement dynamic argument extraction + + * Add mock data to lesson repository + + * Fix rebase + + * Rename argument + + * Drop generic repository interface + + * Simplify repository filter methods + + * Fix type of theme id in filter + + * Delete unused imports + + * Convert lesson statuses factory to repository + + * Move mock data for step out of query + + * Dynamically load repositories + + * Cleanup context extensions + + * Add repository implementation in the Data layer + + * Extend DB model + + * Configure how duration is converted from the database + + * Use entities that derive from models + + Not convinced this is a good approach. + Alternative is to more verbose map from + entities to the models, but have to consider how we load associations. + Todo this later. + + * Use real repositories + + Side effect is to make repositories scoped to match the db context scope. Ideally we would have them still singleton and figure out a way to inject the scoped context since nothing would run outside a scope + + * Add how to run + + * Update context and add converter for id + + * Make ids strings and generate them client side + + * Seed dummy data + + * Include thumnail for theme + + * Drop special method for cursor + +:100644 100644 4a1f619 114e1d0 M README.md +:100644 000000 f0d88d9 0000000 D TeacherWorkout.Api/GraphQL/Mock/LessonFactory.cs +:100644 000000 f6e0f9b 0000000 D TeacherWorkout.Api/GraphQL/Mock/ThemeFactory.cs +:100644 100644 e80059d 1f5354c M TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs +:100644 100644 250f13b 2246a37 M TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +:100644 100644 a08fb70 846fd45 M TeacherWorkout.Api/GraphQL/TeacherWorkoutQuery.cs +:100644 100644 158c126 62eba6f M TeacherWorkout.Api/GraphQL/TeacherWorkoutSchema.cs +:100644 100644 dee5fff 2bab846 M TeacherWorkout.Api/GraphQL/Types/AnswerResultType.cs +:100644 100644 884af64 6fc6b67 M TeacherWorkout.Api/GraphQL/Types/AnswerStatusEnum.cs +:100644 100644 f54afe8 3a441e5 M TeacherWorkout.Api/GraphQL/Types/AnswerType.cs +:100644 100644 b0dd936 b5bef80 M TeacherWorkout.Api/GraphQL/Types/DurationType.cs +:100644 100644 366b2d8 9c33bd4 M TeacherWorkout.Api/GraphQL/Types/DurationUnitEnum.cs +:100644 100644 0bb0799 14678e3 M TeacherWorkout.Api/GraphQL/Types/ExerciseStepType.cs +:100644 100644 14f5972 082766a M TeacherWorkout.Api/GraphQL/Types/ExerciseSummaryStepType.cs +:100644 100644 7398eb0 361bbca M TeacherWorkout.Api/GraphQL/Types/ImageType.cs +:100644 100644 79a80d6 7cc9be9 M TeacherWorkout.Api/GraphQL/Types/Inputs/LessonSaveInputType.cs +:100644 100644 47a0f54 359d899 M TeacherWorkout.Api/GraphQL/Types/LessonStatusType.cs +:100644 100644 3f5e330 de41236 M TeacherWorkout.Api/GraphQL/Types/LessonStepInterface.cs +:100644 100644 eeaa9c6 694433e M TeacherWorkout.Api/GraphQL/Types/LessonSummaryStepType.cs +:100644 100644 ce6ff84 3d7175c M TeacherWorkout.Api/GraphQL/Types/LessonType.cs +:100644 100644 146b13c 9667dda M TeacherWorkout.Api/GraphQL/Types/Payloads/LessonSavePayloadType.cs +:100644 100644 48ddee0 29762b8 M TeacherWorkout.Api/GraphQL/Types/SlideStepType.cs +:100644 100644 2eb88f2 d84dba3 M TeacherWorkout.Api/GraphQL/Types/ThemeType.cs +:100644 100644 8c304c1 d1bbf0e M TeacherWorkout.Api/GraphQL/Utils/ConnectionUtils.cs +:000000 100644 0000000 4836e2b A TeacherWorkout.Api/GraphQL/Utils/ContextExtensions.cs +:100644 000000 f98ee20 0000000 D TeacherWorkout.Api/Models/Duration.cs +:100644 000000 fdcc942 0000000 D TeacherWorkout.Api/Models/ILessonStep.cs +:100644 000000 f519460 0000000 D TeacherWorkout.Api/Models/Image.cs +:100644 100644 580f118 4509059 M TeacherWorkout.Api/Startup.cs +:100644 100644 7a13ee2 98acc64 M TeacherWorkout.Api/TeacherWorkout.Api.csproj +:100644 000000 5c0c5ae 0000000 D TeacherWorkout.Data/Entities/Lesson.cs +:100644 100644 0355f18 5607b1c M TeacherWorkout.Data/Migrations/20210731091520_InitialMigration.cs +:000000 100644 0000000 7773edd A TeacherWorkout.Data/Migrations/20210827110816_DropModels.Designer.cs +:000000 100644 0000000 529d1c5 A TeacherWorkout.Data/Migrations/20210827110816_DropModels.cs +:000000 100644 0000000 ab720ad A TeacherWorkout.Data/Migrations/20210827110854_AddSchema.Designer.cs +:000000 100644 0000000 8a35ecb A TeacherWorkout.Data/Migrations/20210827110854_AddSchema.cs +:000000 100644 0000000 852f0bf A TeacherWorkout.Data/Migrations/20210827110928_SeedDummyData.Designer.cs +:000000 100644 0000000 249cb10 A TeacherWorkout.Data/Migrations/20210827110928_SeedDummyData.cs +:100644 100644 67271c4 7c26d1c M TeacherWorkout.Data/Migrations/TeacherWorkoutContextModelSnapshot.cs +:000000 100644 0000000 dadc8d9 A TeacherWorkout.Data/Repositories/LessonRepository.cs +:000000 100644 0000000 dfe84cd A TeacherWorkout.Data/Repositories/ThemeRepository.cs +:100644 100644 fee6f5f fbe01c3 M TeacherWorkout.Data/TeacherWorkout.Data.csproj +:100644 100644 a741be6 939b9e1 M TeacherWorkout.Data/TeacherWorkoutContext.cs +:000000 100644 0000000 9bca29f A TeacherWorkout.Data/Utils/IdSerializer.cs +:100644 100644 5ef56ac 30e7fed R068 TeacherWorkout.Api/Models/IIdentifiable.cs TeacherWorkout.Domain/Common/IIdentifiable.cs +:000000 100644 0000000 97dc0a5 A TeacherWorkout.Domain/Common/IOperation.cs +:000000 100644 0000000 5d34f39 A TeacherWorkout.Domain/Common/PaginatedResult.cs +:000000 100644 0000000 3375c46 A TeacherWorkout.Domain/Common/PaginationFilter.cs +:000000 100644 0000000 7af12da A TeacherWorkout.Domain/Common/Unit.cs +:000000 100644 0000000 5c98356 A TeacherWorkout.Domain/Lessons/GetLessonStatuses.cs +:000000 100644 0000000 05229a4 A TeacherWorkout.Domain/Lessons/GetLessons.cs +:000000 100644 0000000 5a43f55 A TeacherWorkout.Domain/Lessons/GetStep.cs +:000000 100644 0000000 94f63af A TeacherWorkout.Domain/Lessons/ILessonRepository.cs +:000000 100644 0000000 75a0345 A TeacherWorkout.Domain/Lessons/ILessonStatusRepository.cs +:000000 100644 0000000 6b3d4fc A TeacherWorkout.Domain/Lessons/IStepRepository.cs +:000000 100644 0000000 5cf8f74 A TeacherWorkout.Domain/Lessons/LessonFilter.cs +:000000 100644 0000000 3ae6f81 A TeacherWorkout.Domain/Lessons/LessonStatusFilter.cs +:000000 100644 0000000 9854168 A TeacherWorkout.Domain/Lessons/LessonStatusFindInput.cs +:100644 100644 fb6c186 a6cfabc R065 TeacherWorkout.Api/Models/Answer.cs TeacherWorkout.Domain/Models/Answer.cs +:100644 100644 17a36bb 20468cb R078 TeacherWorkout.Api/Models/AnswerResult.cs TeacherWorkout.Domain/Models/AnswerResult.cs +:100644 100644 57bdb83 98796b9 R072 TeacherWorkout.Api/Models/AnswerStatus.cs TeacherWorkout.Domain/Models/AnswerStatus.cs +:000000 100644 0000000 1826b89 A TeacherWorkout.Domain/Models/Duration.cs +:100644 100644 d582d70 a597a5b R067 TeacherWorkout.Api/Models/DurationUnit.cs TeacherWorkout.Domain/Models/DurationUnit.cs +:100644 100644 69c6873 130c612 R085 TeacherWorkout.Api/Models/ExerciseStep.cs TeacherWorkout.Domain/Models/ExerciseStep.cs +:100644 100644 ec9da8a c271f84 R083 TeacherWorkout.Api/Models/ExerciseSummaryStep.cs TeacherWorkout.Domain/Models/ExerciseSummaryStep.cs +:000000 100644 0000000 b3f5e6a A TeacherWorkout.Domain/Models/ILessonStep.cs +:000000 100644 0000000 c8110e3 A TeacherWorkout.Domain/Models/Image.cs +:100644 100644 e2cb952 3c63294 R066 TeacherWorkout.Api/Models/Inputs/LessonSaveInput.cs TeacherWorkout.Domain/Models/Inputs/LessonSaveInput.cs +:100644 100644 2f3dc89 b7cf499 R081 TeacherWorkout.Api/Models/Lesson.cs TeacherWorkout.Domain/Models/Lesson.cs +:100644 100644 75ef2f1 7f5db7c R083 TeacherWorkout.Api/Models/LessonStaus.cs TeacherWorkout.Domain/Models/LessonStaus.cs +:100644 100644 796f09b 7492165 R079 TeacherWorkout.Api/Models/LessonSummaryStep.cs TeacherWorkout.Domain/Models/LessonSummaryStep.cs +:100644 100644 df8ead4 6ae9eb1 R065 TeacherWorkout.Api/Models/Payloads/LessonSavePayload.cs TeacherWorkout.Domain/Models/Payloads/LessonSavePayload.cs +:100644 100644 d120411 2f8e78a R088 TeacherWorkout.Api/Models/SlideStep.cs TeacherWorkout.Domain/Models/SlideStep.cs +:100644 100644 aeb6740 91c1d31 R070 TeacherWorkout.Api/Models/Theme.cs TeacherWorkout.Domain/Models/Theme.cs +:000000 100644 0000000 4a01788 A TeacherWorkout.Domain/TeacherWorkout.Domain.csproj +:000000 100644 0000000 d9569d4 A TeacherWorkout.Domain/Themes/GetThemes.cs +:000000 100644 0000000 fb2cace A TeacherWorkout.Domain/Themes/IThemeRepository.cs +:000000 100644 0000000 18a8654 A TeacherWorkout.MockData/Repositories/LessonRepository.cs +:100644 100644 97087e7 f1d1ce4 R090 TeacherWorkout.Api/GraphQL/Mock/LessonStatusFactory.cs TeacherWorkout.MockData/Repositories/LessonStatusRepository.cs +:100644 100644 cd3e9b7 98d3d2d R096 TeacherWorkout.Api/GraphQL/Mock/StepFactory.cs TeacherWorkout.MockData/Repositories/StepRepository.cs +:000000 100644 0000000 d1e9423 A TeacherWorkout.MockData/Repositories/ThemeRepository.cs +:000000 100644 0000000 c488bbf A TeacherWorkout.MockData/TeacherWorkout.MockData.csproj +:100644 100644 44143ca 5625f18 M TeacherWorkout.sln + +commit 2cbe38e5f24d4860f5e4e56add565ff135bc8f38 +Author: Gabriel Majeri +Date: Thu Aug 26 10:59:08 2021 +0300 + + Add support for GraphiQL (#47) + +:100644 100644 b452544 4a1f619 M README.md +:100644 100644 82c5ef7 580f118 M TeacherWorkout.Api/Startup.cs +:100644 100644 ed17f7a 7a13ee2 M TeacherWorkout.Api/TeacherWorkout.Api.csproj + +commit 15841df14464dfae49dcbee7e2d249aa9aed4aa9 +Author: alina-dicoiu <37511235+alina-dicoiu@users.noreply.github.com> +Date: Sat Jul 31 16:19:11 2021 +0300 + + Added project for data layer (#43) + +:100644 100644 6d7455b 60630bd M .env.example +:100644 100644 588fb74 99b14bf M Dockerfile +:100644 100644 cbc0411 82c5ef7 M TeacherWorkout.Api/Startup.cs +:100644 100644 c18d5a5 ed17f7a M TeacherWorkout.Api/TeacherWorkout.Api.csproj +:100644 100644 8983e0f 801d530 M TeacherWorkout.Api/appsettings.Development.json +:100644 100644 d9d9a9b 397ab92 M TeacherWorkout.Api/appsettings.json +:000000 100644 0000000 5c0c5ae A TeacherWorkout.Data/Entities/Lesson.cs +:000000 100644 0000000 2f7e66b A TeacherWorkout.Data/Migrations/20210731091520_InitialMigration.Designer.cs +:000000 100644 0000000 0355f18 A TeacherWorkout.Data/Migrations/20210731091520_InitialMigration.cs +:000000 100644 0000000 67271c4 A TeacherWorkout.Data/Migrations/TeacherWorkoutContextModelSnapshot.cs +:000000 100644 0000000 fee6f5f A TeacherWorkout.Data/TeacherWorkout.Data.csproj +:000000 100644 0000000 a741be6 A TeacherWorkout.Data/TeacherWorkoutContext.cs +:100644 100644 e4ea824 44143ca M TeacherWorkout.sln + +commit 53490c73e2e0e055802a6f60ec099e34fa6e6cfe +Author: radu <39530866+RaduBuciuceanu@users.noreply.github.com> +Date: Sat Jul 31 16:06:10 2021 +0300 + + [feature/42] Make theme id optional (#44) + +:100644 100644 add7c28 a08fb70 M TeacherWorkout.Api/GraphQL/TeacherWorkoutQuery.cs + +commit 7ba2e26a031dadb1763590aca005ab446f046538 +Author: radu <39530866+RaduBuciuceanu@users.noreply.github.com> +Date: Sat Jul 31 15:59:49 2021 +0300 + + [feature/40] Add description to lesson (#41) + + * [feature/40] Create new factories + + * [feature/40] Cange query root node + + * [feature/40] Change lesson graph type + + * [feature/40] Change lesson model + + * [feature/40] Change project file + +:000000 100644 0000000 f0d88d9 A TeacherWorkout.Api/GraphQL/Mock/LessonFactory.cs +:000000 100644 0000000 97087e7 A TeacherWorkout.Api/GraphQL/Mock/LessonStatusFactory.cs +:000000 100644 0000000 cd3e9b7 A TeacherWorkout.Api/GraphQL/Mock/StepFactory.cs +:000000 100644 0000000 f6e0f9b A TeacherWorkout.Api/GraphQL/Mock/ThemeFactory.cs +:100644 100644 fbd1764 add7c28 M TeacherWorkout.Api/GraphQL/TeacherWorkoutQuery.cs +:100644 100644 4c30cd7 ce6ff84 M TeacherWorkout.Api/GraphQL/Types/LessonType.cs +:100644 100644 87d7fa0 2f3dc89 M TeacherWorkout.Api/Models/Lesson.cs +:100644 100644 f223e34 c18d5a5 M TeacherWorkout.Api/TeacherWorkout.Api.csproj + +commit 9129ee6779de4ed9be00f3d023466592e09bef93 +Author: Micusan Lidia <35565172+MicusanL@users.noreply.github.com> +Date: Sat Jul 31 11:26:01 2021 +0300 + + Revert "Fix references" (#38) + + * Revert "Fix references (#37)" + + This reverts commit 931c122d02a19c3bdb4a4d43a03f4ba9ab174881. + + * Remove references + +:100644 100644 4dc09b6 f223e34 M TeacherWorkout.Api/TeacherWorkout.Api.csproj + +commit 931c122d02a19c3bdb4a4d43a03f4ba9ab174881 (origin/develop, origin/HEAD) +Author: Micusan Lidia <35565172+MicusanL@users.noreply.github.com> +Date: Sat Jul 31 11:21:09 2021 +0300 + + Fix references (#37) + + Co-authored-by: MicusanL + +:100644 100644 c6a66c4 4dc09b6 M TeacherWorkout.Api/TeacherWorkout.Api.csproj + +commit e3201b367d57c03c471b1d345940af440ad21067 +Author: Alex Damian Negru +Date: Wed Jul 21 14:13:36 2021 +0300 + + Implement LessonSave mutation (#31) + + * Add initial mutation with `LessonSave` + + * Extract mock LessonSave resolver + + * Take input into account + + * Extract LessonSaveResolver#Resolve + + * Auto-register GraphQL `Inputs` & `Types` namespaces + + * Reorganize input and output types + + Co-authored-by: pirvudoru + +:000000 100644 0000000 e80059d A TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs +:000000 100644 0000000 250f13b A TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +:100644 100644 c447156 158c126 M TeacherWorkout.Api/GraphQL/TeacherWorkoutSchema.cs +:000000 100644 0000000 79a80d6 A TeacherWorkout.Api/GraphQL/Types/Inputs/LessonSaveInputType.cs +:000000 100644 0000000 146b13c A TeacherWorkout.Api/GraphQL/Types/Payloads/LessonSavePayloadType.cs +:000000 100644 0000000 e2cb952 A TeacherWorkout.Api/Models/Inputs/LessonSaveInput.cs +:000000 100644 0000000 df8ead4 A TeacherWorkout.Api/Models/Payloads/LessonSavePayload.cs +:100644 100644 4a773d1 cbc0411 M TeacherWorkout.Api/Startup.cs +:100644 100644 62894ff c6a66c4 M TeacherWorkout.Api/TeacherWorkout.Api.csproj + +commit 984d10859e46ee44f10566a3dad928eacc708044 +Author: anamarisimo <48225513+anamarisimo@users.noreply.github.com> +Date: Fri Jul 16 15:03:13 2021 +0300 + + Add dummy items in query lists (#35) + +:100644 100644 e4ee4eb fbd1764 M TeacherWorkout.Api/GraphQL/TeacherWorkoutQuery.cs + +commit 4ba74769e3f47cc8537046f9133489fac175c06b +Author: Doru Pirvu +Date: Mon Jul 12 10:54:20 2021 +0300 + + Convert lessons and themes nodes to Relay Connections (#34) + + * Convert themes to connection + + * Convert lessons to connection + + * Extract connection helper + + * Add extra theme mock data + + * Add extra entries for lessons and themes + +:100644 100644 f0066a4 e4ee4eb M TeacherWorkout.Api/GraphQL/TeacherWorkoutQuery.cs +:000000 100644 0000000 8c304c1 A TeacherWorkout.Api/GraphQL/Utils/ConnectionUtils.cs +:100644 100644 9d9ab1f fb6c186 M TeacherWorkout.Api/Models/Answer.cs +:000000 100644 0000000 5ef56ac A TeacherWorkout.Api/Models/IIdentifiable.cs +:100644 100644 68dddba fdcc942 M TeacherWorkout.Api/Models/ILessonStep.cs +:100644 100644 7705f3b 87d7fa0 M TeacherWorkout.Api/Models/Lesson.cs +:100644 100644 2e35093 aeb6740 M TeacherWorkout.Api/Models/Theme.cs + +commit 31cc0cb73da83137192a5dc81e48f55b4d41eb86 +Author: Doru Pirvu +Date: Tue Jul 6 20:23:59 2021 +0300 + + Update README.md (#33) + + Add staging URL + Update badge URLs + +:100644 100644 fe35b7a b452544 M README.md + +commit 3d871d1ba0c28efb8a9387a2d588e1b10fd47bb4 +Author: catileptic +Date: Sun Jun 27 11:01:02 2021 +0300 + + Connection string to match DB settings (#30) + +:100644 100644 a067802 6d7455b M .env.exa \ No newline at end of file From db0865e92c1498c39e4c344673f119d408cca836 Mon Sep 17 00:00:00 2001 From: Simona Zgarcea Date: Sun, 26 Sep 2021 11:55:09 +0300 Subject: [PATCH 4/5] adding user for lessonSave --- .../GraphQL/Resolvers/LessonSaveResolver.cs | 2 +- .../GraphQL/TeacherWorkoutMutation.cs | 17 ++++++++++++++--- TeacherWorkout.Domain/Common/IUser.cs | 14 ++++++++++++++ TeacherWorkout.Domain/Models/User.cs | 12 ++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 TeacherWorkout.Domain/Common/IUser.cs create mode 100644 TeacherWorkout.Domain/Models/User.cs diff --git a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs index ea93120..8a3b865 100644 --- a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs +++ b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs @@ -21,7 +21,7 @@ public LessonSaveResolver (IContext context, ILessonStatusRepository lessonStatu _lessonRepository = lessonRepository; } - + ` public LessonSavePayload Execute(LessonSaveInput input) { Lesson lesson = _lessonRepository.Find(input.LessonId); diff --git a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs index 10a7718..b2b492e 100644 --- a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +++ b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs @@ -13,7 +13,7 @@ public class TeacherWorkoutMutation : ObjectGraphType public TeacherWorkoutMutation(CompleteStep completeStep, LessonSaveResolver lessonSaveResolver) { Name = "Mutation"; - + Field>( "lessonSave", arguments: new QueryArguments( @@ -22,8 +22,19 @@ public TeacherWorkoutMutation(CompleteStep completeStep, LessonSaveResolver less resolve: context => { var lessonSave = context.GetArgument("input"); - - return lessonSaveResolver.Execute(lessonSave); + + return LessonSaveResolver.Resolve(lessonSave); + }); + + Field( + "stepComplete", + arguments: new QueryArguments( + new QueryArgument> { Name = "input" } + ), + resolve: context => + { + var stepComplete = context.GetArgument("input"); + return completeStep.Execute(stepComplete); }); Field( diff --git a/TeacherWorkout.Domain/Common/IUser.cs b/TeacherWorkout.Domain/Common/IUser.cs new file mode 100644 index 0000000..4644a90 --- /dev/null +++ b/TeacherWorkout.Domain/Common/IUser.cs @@ -0,0 +1,14 @@ +using TeacherWorkout.Domain.Models; + +namespace TeacherWorkout.Domain.Common +{ + public interface IContext + { + public User CurentUser { get; } + } + + public class Context : IContext + { + public User CurentUser { get; set; } + } +} \ No newline at end of file diff --git a/TeacherWorkout.Domain/Models/User.cs b/TeacherWorkout.Domain/Models/User.cs new file mode 100644 index 0000000..1463a82 --- /dev/null +++ b/TeacherWorkout.Domain/Models/User.cs @@ -0,0 +1,12 @@ +using TeacherWorkout.Domain.Common; + +namespace TeacherWorkout.Domain.Models +{ + public class User : IIdentifiable + { + public string Id { get; set; } + + public string Name { get; set; } + + } +} From 2bc9cf5457152380ac2551e989ce48806cae6b41 Mon Sep 17 00:00:00 2001 From: Simona Zgarcea Date: Sun, 26 Sep 2021 11:56:19 +0300 Subject: [PATCH 5/5] adding user for lessonSave - add missing files --- .../GraphQL/Resolvers/LessonSaveResolver.cs | 2 +- .../GraphQL/TeacherWorkoutMutation.cs | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs index 8a3b865..ce18cba 100644 --- a/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs +++ b/TeacherWorkout.Api/GraphQL/Resolvers/LessonSaveResolver.cs @@ -21,7 +21,7 @@ public LessonSaveResolver (IContext context, ILessonStatusRepository lessonStatu _lessonRepository = lessonRepository; } - ` + public LessonSavePayload Execute(LessonSaveInput input) { Lesson lesson = _lessonRepository.Find(input.LessonId); diff --git a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs index b2b492e..c95e1f0 100644 --- a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +++ b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs @@ -23,18 +23,7 @@ public TeacherWorkoutMutation(CompleteStep completeStep, LessonSaveResolver less { var lessonSave = context.GetArgument("input"); - return LessonSaveResolver.Resolve(lessonSave); - }); - - Field( - "stepComplete", - arguments: new QueryArguments( - new QueryArgument> { Name = "input" } - ), - resolve: context => - { - var stepComplete = context.GetArgument("input"); - return completeStep.Execute(stepComplete); + return lessonSaveResolver.Execute(lessonSave); }); Field(