Files
mixtape/zero.Web/Controllers/IntegrationsController.cs
T

72 lines
1.8 KiB
C#
Raw Normal View History

2020-12-10 15:57:59 +01:00
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
2021-01-13 23:50:03 +01:00
using zero.Core.Entities;
2020-12-10 15:57:59 +01:00
using zero.Core.Integrations;
namespace zero.Web.Controllers
{
//[ZeroAuthorize(Permissions.Sections.Spaces, PermissionsValue.True)]
public class IntegrationsController : BackofficeController
{
2020-12-16 13:22:18 +01:00
IIntegrationsCollection Integrations;
2021-01-13 23:50:03 +01:00
IIntegrationService Types;
2020-12-10 15:57:59 +01:00
2021-01-13 23:50:03 +01:00
public IntegrationsController(IIntegrationsCollection integrations, IIntegrationService types)
2020-12-10 15:57:59 +01:00
{
Integrations = integrations;
2020-12-16 13:22:18 +01:00
Types = types;
2020-12-10 15:57:59 +01:00
}
public async Task<IActionResult> GetAll()
{
return Ok(new
{
2021-01-13 23:50:03 +01:00
//available = await Types.GetAvailable(),
//activated = await Types.GetActivated()
2020-12-10 15:57:59 +01:00
});
}
public IActionResult GetEmptySettings([FromQuery] string alias)
{
2021-01-13 23:50:03 +01:00
//IIntegration integration = Types.GetByAlias(alias);
//IIntegrationModel model = integration != null ? Activator.CreateInstance(integration.ModelType) as IIntegrationModel : null;
2020-12-10 15:57:59 +01:00
2021-01-13 23:50:03 +01:00
//if (model != null)
//{
// model.IntegrationAlias = integration.Alias;
//}
2020-12-10 15:57:59 +01:00
2021-01-13 23:50:03 +01:00
return Ok(Edit(default(IIntegration)));
2020-12-10 15:57:59 +01:00
}
public async Task<IActionResult> GetSettingsByAlias([FromQuery] string alias)
{
2021-01-13 23:50:03 +01:00
//IIntegrationModel content = await Integrations.GetByAlias(alias);
return Ok(Edit(default(IIntegration)));
2020-12-10 15:57:59 +01:00
}
public async Task<IActionResult> GetSettingsById([FromQuery] string id)
{
2021-01-13 23:50:03 +01:00
//IIntegrationModel content = await Integrations.GetById(id);
return Ok(Edit(default(IIntegration)));
2020-12-10 15:57:59 +01:00
}
2020-12-16 13:22:18 +01:00
public async Task<IActionResult> Save([FromBody] IIntegration model)
2020-12-10 15:57:59 +01:00
{
2021-01-13 23:50:03 +01:00
return Ok();
//return Ok(await Integrations.Save(model));
2020-12-10 15:57:59 +01:00
}
public async Task<IActionResult> Delete([FromQuery] string id)
{
2020-12-16 13:22:18 +01:00
return Ok(await Integrations.DeleteById(id));
2020-12-10 15:57:59 +01:00
}
}
}