controller updated for entity
This commit is contained in:
parent
49342a8c39
commit
d286c4fd9a
@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newsbot.Collector.Database.Repositories;
|
using Newsbot.Collector.Database.Repositories;
|
||||||
using Newsbot.Collector.Domain.Dto;
|
using Newsbot.Collector.Domain.Dto;
|
||||||
|
using Newsbot.Collector.Domain.Entities;
|
||||||
using Newsbot.Collector.Domain.Interfaces;
|
using Newsbot.Collector.Domain.Interfaces;
|
||||||
using Newsbot.Collector.Domain.Models;
|
using Newsbot.Collector.Domain.Models;
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ public class SubscriptionsController : ControllerBase
|
|||||||
public IEnumerable<SubscriptionDto> GetBySourceId(Guid id)
|
public IEnumerable<SubscriptionDto> GetBySourceId(Guid id)
|
||||||
{
|
{
|
||||||
var res = new List<SubscriptionDto>();
|
var res = new List<SubscriptionDto>();
|
||||||
var items = _subscription.ListBySourceID(id);
|
var items = _subscription.ListBySourceId(id);
|
||||||
foreach (var item in items) res.Add(SubscriptionDto.Convert(item));
|
foreach (var item in items) res.Add(SubscriptionDto.Convert(item));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -88,7 +89,7 @@ public class SubscriptionsController : ControllerBase
|
|||||||
var source = _sources.GetById(sourceId);
|
var source = _sources.GetById(sourceId);
|
||||||
if (source.Id == Guid.Empty) return new BadRequestResult();
|
if (source.Id == Guid.Empty) return new BadRequestResult();
|
||||||
|
|
||||||
var item = _subscription.New(new SubscriptionModel
|
var item = _subscription.New(new SubscriptionEntity
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
SourceId = sourceId,
|
SourceId = sourceId,
|
||||||
@ -116,7 +117,7 @@ public class SubscriptionsController : ControllerBase
|
|||||||
var source = _sources.GetById(sourceId);
|
var source = _sources.GetById(sourceId);
|
||||||
if (source.Id == Guid.Empty) return new BadRequestResult();
|
if (source.Id == Guid.Empty) return new BadRequestResult();
|
||||||
|
|
||||||
var sub = _subscription.New(new SubscriptionModel
|
var sub = _subscription.New(new SubscriptionEntity
|
||||||
{
|
{
|
||||||
DiscordWebHookId = discordId,
|
DiscordWebHookId = discordId,
|
||||||
SourceId = sourceId,
|
SourceId = sourceId,
|
||||||
|
Loading…
Reference in New Issue
Block a user