Compare commits

..

2 Commits

Author SHA1 Message Date
e364b47c0f details pages for channels added 2024-06-09 17:37:09 -04:00
c6ea3ef790 integrate swagger 2024-06-02 18:37:04 -04:00
4 changed files with 52 additions and 7 deletions

View File

@ -13,6 +13,7 @@ builder.Services.Configure<RazorViewEngineOptions>(o => {
o.ViewLocationFormats.Add("/WebInterface/Views/{1}/{0}" + RazorViewEngine.ViewExtension); o.ViewLocationFormats.Add("/WebInterface/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
o.ViewLocationFormats.Add("/WebInterface/Views/Shared/{0}" + RazorViewEngine.ViewExtension); o.ViewLocationFormats.Add("/WebInterface/Views/Shared/{0}" + RazorViewEngine.ViewExtension);
}); });
builder.Services.AddSwaggerGen();
var app = builder.Build(); var app = builder.Build();
@ -29,5 +30,11 @@ app.MapControllerRoute(
name: "default", name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}"); pattern: "{controller=Home}/{action=Index}/{id?}");
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "api");
});
app.Run(); app.Run();

View 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();
}
}

View File

@ -14,11 +14,11 @@
</tr> </tr>
<tr> <tr>
<th scope="row">Lewdness Filter Level</th> <th scope="row">Lewdness Filter Level</th>
<td>@Model.LewdnessFilterLevel</td> <td>@(Model.LewdnessFilterLevel?.ToString() ?? "inherited")</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Links Allowed</th> <th scope="row">Links Allowed</th>
<td>@Model.LinksAllowed</td> <td>@(Model.LinksAllowed?.ToString() ?? "unknown")</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Lineage summary</th> <th scope="row">Lineage summary</th>
@ -30,11 +30,11 @@
</tr> </tr>
<tr> <tr>
<th scope="row">max message length</th> <th scope="row">max message length</th>
<td>@Model.MaxTextChars</td> <td>@(Model.MaxTextChars?.ToString() ?? "inherited")</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Meanness Filter Level</th> <th scope="row">Meanness Filter Level</th>
<td>@Model.MeannessFilterLevel</td> <td>@(Model.MeannessFilterLevel?.ToString() ?? "inherited")</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Messages (count)</th> <th scope="row">Messages (count)</th>
@ -46,15 +46,15 @@
</tr> </tr>
<tr> <tr>
<th scope="row">Reactions Possible</th> <th scope="row">Reactions Possible</th>
<td>@Model.ReactionsPossible</td> <td>@(Model.ReactionsPossible?.ToString() ?? "inherited")</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Sub Channels</th> <th scope="row">Sub Channels</th>
<td>@Model.SubChannels</td> <td>@(Model.SubChannels?.Count ?? 0)</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Users</th> <th scope="row">Users</th>
<td>@Model.Users</td> <td>@(Model.Users?.Count ?? 0)</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -19,6 +19,9 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="QRCoder" Version="1.4.2" /> <PackageReference Include="QRCoder" Version="1.4.2" />
<PackageReference Include="RestSharp" Version="110.2.0" /> <PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.6.2" />
<PackageReference Include="TwitchLib" Version="3.5.3" /> <PackageReference Include="TwitchLib" Version="3.5.3" />
<PackageReference Include="youtubedlsharp" Version="0.3.1" /> <PackageReference Include="youtubedlsharp" Version="0.3.1" />
</ItemGroup> </ItemGroup>