forked from adam/discord-bot-shtik
details pages for channels added
This commit is contained in:
parent
c6ea3ef790
commit
e364b47c0f
@ -34,7 +34,7 @@ app.UseSwagger();
|
||||
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Sample API");
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "api");
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
@ -1,41 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using vassago.Models;
|
||||
|
||||
namespace vassago.Controllers;
|
||||
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class EmployeeController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public IEnumerable<Account> Get()
|
||||
{
|
||||
return GetEmployeesDeatils();
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
[Produces("application/json")]
|
||||
public Account Get(Guid id)
|
||||
{
|
||||
return GetEmployeesDeatils().Find(e => e.Id == id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/json")]
|
||||
public Account Post([FromBody] Account employee)
|
||||
{
|
||||
// Write logic to insert employee data
|
||||
return new Account();
|
||||
}
|
||||
|
||||
private List<Account> GetEmployeesDeatils()
|
||||
{
|
||||
return new List<Account>()
|
||||
{
|
||||
new Account()
|
||||
};
|
||||
}
|
||||
}
|
35
WebInterface/Controllers/api/ChannelsControler.cs
Normal file
35
WebInterface/Controllers/api/ChannelsControler.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using vassago.Models;
|
||||
|
||||
namespace vassago.Controllers.api;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ChannelsController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<ChannelsController> _logger;
|
||||
private readonly ChattingContext _db;
|
||||
|
||||
public ChannelsController(ILogger<ChannelsController> logger, ChattingContext db)
|
||||
{
|
||||
_logger = logger;
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
[Produces("application/json")]
|
||||
public Channel Get(Guid id)
|
||||
{
|
||||
return _db.Find<Channel>(id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/json")]
|
||||
public Channel Post([FromBody] Channel channel)
|
||||
{
|
||||
// Write logic to insert employee data
|
||||
return new Channel();
|
||||
}
|
||||
}
|
@ -14,11 +14,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Lewdness Filter Level</th>
|
||||
<td>@Model.LewdnessFilterLevel</td>
|
||||
<td>@(Model.LewdnessFilterLevel?.ToString() ?? "inherited")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Links Allowed</th>
|
||||
<td>@Model.LinksAllowed</td>
|
||||
<td>@(Model.LinksAllowed?.ToString() ?? "unknown")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Lineage summary</th>
|
||||
@ -30,11 +30,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">max message length</th>
|
||||
<td>@Model.MaxTextChars</td>
|
||||
<td>@(Model.MaxTextChars?.ToString() ?? "inherited")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Meanness Filter Level</th>
|
||||
<td>@Model.MeannessFilterLevel</td>
|
||||
<td>@(Model.MeannessFilterLevel?.ToString() ?? "inherited")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Messages (count)</th>
|
||||
@ -46,15 +46,15 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Reactions Possible</th>
|
||||
<td>@Model.ReactionsPossible</td>
|
||||
<td>@(Model.ReactionsPossible?.ToString() ?? "inherited")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Sub Channels</th>
|
||||
<td>@Model.SubChannels</td>
|
||||
<td>@(Model.SubChannels?.Count ?? 0)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Users</th>
|
||||
<td>@Model.Users</td>
|
||||
<td>@(Model.Users?.Count ?? 0)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user