Merge branch 'master' of http://git.vdk2ch.ru:3000/RakVhalate/2chBackAPI into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
63330d5fc0
35
.vscode/launch.json
vendored
Normal file
35
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/bin/Debug/net6.0/NeDvachAPI.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
41
.vscode/tasks.json
vendored
Normal file
41
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/NeDvachAPI.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/NeDvachAPI.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/NeDvachAPI.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
17
Controllers/TestPosting.cs
Normal file
17
Controllers/TestPosting.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace NeDvachAPI.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class TestPostingController : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
public int Area(int altitude , int height)
|
||||
{
|
||||
//DBchat.SendPost(ReceivedPost);
|
||||
return altitude+height;
|
||||
}
|
||||
}
|
||||
}
|
14
DBchat.cs
14
DBchat.cs
@ -5,7 +5,6 @@ namespace NeDvachAPI
|
||||
public class DBchat
|
||||
{
|
||||
// Obtain connection string information from the portal
|
||||
//
|
||||
private static string Host = "postgres.vdk2ch.ru";
|
||||
private static string User = "postgres";
|
||||
private static string DBname = "postgres";
|
||||
@ -34,7 +33,13 @@ namespace NeDvachAPI
|
||||
conn.Open();
|
||||
|
||||
|
||||
using (var command = new NpgsqlCommand("SELECT * FROM (SELECT post_id, substring(post,1,200) FROM dvach ORDER BY post_id DESC limit 10) subquery ORDER BY post_id ASC", conn))
|
||||
using (var command = new NpgsqlCommand(@"
|
||||
SELECT * FROM
|
||||
(SELECT post_id, substring(post,1,200)
|
||||
FROM dvach
|
||||
ORDER BY post_id
|
||||
DESC limit 10)
|
||||
subquery ORDER BY post_id ASC", conn))
|
||||
{
|
||||
|
||||
var reader = command.ExecuteReader();
|
||||
@ -113,8 +118,9 @@ namespace NeDvachAPI
|
||||
Console.Out.WriteLine("Opening connection");
|
||||
conn.Open();
|
||||
|
||||
using (var command = new NpgsqlCommand("INSERT INTO dvach " +
|
||||
"(post_id, post) VALUES (DEFAULT, @postText)", conn))
|
||||
using (var command = new NpgsqlCommand(@"
|
||||
INSERT INTO dvach " + @"(post_id, post)
|
||||
VALUES (DEFAULT, @postText)", conn))
|
||||
{
|
||||
command.Parameters.AddWithValue("postText", postToSend.Text);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Default": "Debug",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Default": "Debug",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user