Esempio n. 1
0
        public async Task <IActionResult> PostMySubscriptions([FromBody] SubscribeManyDto request)
        {
            foreach (var dto in request.Subscribe.OrEmpty())
            {
                var update = dto.ToUpdate();

                await subscriptionStore.UpsertAsync(App.Id, UserId, dto.TopicPrefix, update, HttpContext.RequestAborted);
            }

            foreach (var topic in request.Unsubscribe.OrEmpty())
            {
                await subscriptionStore.DeleteAsync(App.Id, UserId, topic, HttpContext.RequestAborted);
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteSubscription(string appId, string id, string prefix)
        {
            var user = await userStore.GetAsync(appId, id, HttpContext.RequestAborted);

            if (user == null)
            {
                return(NotFound());
            }

            await subscriptionStore.DeleteAsync(appId, id, prefix, HttpContext.RequestAborted);

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <IActionResult> PostSubscriptions(string appId, string id, [FromBody] SubscribeManyDto request)
        {
            var user = await userStore.GetAsync(appId, id, HttpContext.RequestAborted);

            if (user == null)
            {
                return(NotFound());
            }

            foreach (var dto in request.Subscribe.OrEmpty())
            {
                var update = dto.ToUpdate();

                await subscriptionStore.UpsertAsync(appId, id, dto.TopicPrefix, update, HttpContext.RequestAborted);
            }

            foreach (var topic in request.Unsubscribe.OrEmpty())
            {
                await subscriptionStore.DeleteAsync(appId, id, topic, HttpContext.RequestAborted);
            }

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> DeleteSubscription(string topic)
        {
            await subscriptionStore.DeleteAsync(App.Id, UserId !, topic, HttpContext.RequestAborted);

            return(NoContent());
        }