public GroupType(NotificationFacade notificationFacade, UserGroupFacade userGroupFacade, GroupSubjectFacade groupSubjectFacade) { Field(x => x.Id); Field <StringGraphType>("name", resolve: context => context.Source.Name); Field <ListGraphType <NotificationType> >( "notifications", resolve: context => notificationFacade.GetByGroupId(context.Source.Id)); Field <ListGraphType <UserGroupType> >( "userGroups", resolve: context => userGroupFacade.GetByGroupId(context.Source.Id)); Field <ListGraphType <GroupSubjectType> >( "groupSubjects", resolve: context => groupSubjectFacade.GetByGroupId(context.Source.Id)); Field <NotificationType>("notification", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => notificationFacade.GetById(context.GetArgument <int>("id"))); Field <UserGroupType>("userGroup", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => userGroupFacade.GetById(context.GetArgument <int>("id"))); Field <GroupSubjectType>("groupSubject", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => groupSubjectFacade.GetById(context.GetArgument <int>("id"))); }
public void Test() { NotificationFacade notification = new NotificationFacade(); notification.Notify(1, "Hello world") .ShouldBe("SMS-13800138000:Hello world|[email protected]:Hello world"); }
public Mutations(MarkFacade markFacade, UserFacade userFacade, GroupFacade groupFacade, GroupSubjectFacade groupSubjectFacade, NotificationFacade notificationFacade, NotificationStudentFacade notificationStudentFacade, SubjectFacade subjectFacade, UserGroupFacade userGroupFacade, UserMarkFacade userMarkFacade, UserRoleFacade userRoleFacade) { AddMarkMutations(markFacade); AddUserMutations(userFacade, userRoleFacade, userGroupFacade, groupFacade); AddGroupMutations(groupFacade); AddGroupSubjectMutations(groupSubjectFacade, userFacade); AddNotificationMutations(notificationFacade, groupFacade, notificationStudentFacade); AddNotificationStudentMutations(notificationStudentFacade); AddSubjectMutations(subjectFacade); AddUserGroupMutations(userGroupFacade); AddUserMarkMutations(userMarkFacade); AddUserRoleMutations(userRoleFacade); }
public Queries(MarkFacade markFacade, UserFacade userFacade, GroupFacade groupFacade, GroupSubjectFacade groupSubjectFacade, NotificationFacade notificationFacade, NotificationStudentFacade notificationStudentFacade, SubjectFacade subjectFacade, UserGroupFacade userGroupFacade, UserMarkFacade userMarkFacade, UserRoleFacade userRoleFacade) { AddMarkQueries(markFacade); AddUserQueries(userFacade, userRoleFacade); AddGroupQueries(groupFacade); AddGroupSubjectQueries(groupSubjectFacade, subjectFacade, userFacade); AddNotificationQueries(notificationFacade); AddNotificationStudentQueries(notificationStudentFacade); AddSubjectQueries(subjectFacade); AddUserGroupQueries(userGroupFacade); AddUserMarkQueries(userMarkFacade); AddUserRoleQueries(userRoleFacade); AddAuthorizeQueries(userFacade, userRoleFacade); }
private void AddNotificationQueries(NotificationFacade notificationFacade) { Field <ListGraphType <NotificationType> >( "allNotifications", resolve: context => notificationFacade.GetAll() ); Field <NotificationType>("notification", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => { var id = context.GetArgument <int?>("id"); return(id != null ? (notificationFacade.GetById((int)id)) : null); } ); Field <ListGraphType <NotificationType> >("notificationsByGroupId", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "groupId" }), resolve: context => { var groupId = context.GetArgument <int>("groupId"); return(notificationFacade.GetByGroupId(groupId)); } ); }
public IssueController(IssueFacade issueFacade, ProjectFacade projectFacade, CommentFacade commentFacade, PersonFacade personFacade, NotificationFacade notificationFacade) { this.issueFacade = issueFacade; this.projectFacade = projectFacade; this.commentFacade = commentFacade; this.personFacade = personFacade; this.notificationFacade = notificationFacade; }
private void AddNotificationMutations(NotificationFacade notificationFacade, GroupFacade groupFacade, NotificationStudentFacade notificationStudentFacade) { Field <NotificationType>("addNotification", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <NotificationInputType> > { Name = "notification" }), resolve: context => { var notification = context.GetArgument <Notification>("notification"); notification.Group = groupFacade.GetById(notification.GroupId); return(notificationFacade.Add(notification));; } ); Field <NotificationType>("deleteNotification", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "notificationId" }), resolve: context => { var notificationId = context.GetArgument <int>("notificationId"); Notification notification = notificationFacade.GetById(notificationId); notificationStudentFacade.DeleteByNotification(notification); return(notificationFacade.Delete(notification)); } ); Field <ListGraphType <NotificationType> >("notificationsForStudent", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "studentId" }, new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "groupId" } ), resolve: context => { var groupId = context.GetArgument <int>("groupId"); var studentId = context.GetArgument <int>("studentId"); IEnumerable <Notification> notifications = notificationFacade.GetByGroupId(groupId); List <Notification> notificationList = new List <Notification>(); foreach (var notification in notifications) { if (!notificationStudentFacade.getByUserIdAndNotificationId(studentId, notification.Id)) { notificationList.Add(notification); notificationStudentFacade.Add(new NotificationStudent { NotificationId = notification.Id, StudentId = studentId }); } } return(notificationList); } ); }
public NotificationStudentType(NotificationFacade notificationFacade, UserFacade userFacade) { Field(x => x.Id); Field <NotificationType>("notification", resolve: context => notificationFacade.GetById(context.Source.NotificationId) ); Field <UserType>("student", resolve: context => userFacade.GetById(context.Source.StudentId) ); }
public PersonController(PersonFacade personFacade, ApplicationUserFacade applicationUserFacade, NotificationFacade notificationFacade) { this.personFacade = personFacade; this.applicationUserFacade = applicationUserFacade; this.notificationFacade = notificationFacade; }
public NotificationService(long?currentUserID, long?currentHomeID) : base(currentUserID) { NotificationFacade = new NotificationFacade(); CurrentHomeID = currentHomeID; }