Compare commits
282 Commits
v1.0.6-rc1
...
main
Author | SHA1 | Date | |
---|---|---|---|
1f4b3980c7 | |||
7ac48c3bbf | |||
c65de51f9c | |||
c0f1866e9f | |||
0ca4259451 | |||
34e028e6d1 | |||
7a06ce1deb | |||
d691501d42 | |||
1e568279ad | |||
541b891c3b | |||
2615f65515 | |||
f914d712e2 | |||
59063e0fd8 | |||
ac319f9994 | |||
27a55a1cc4 | |||
da7b950eed | |||
d9ff6274d3 | |||
8d36f198d1 | |||
e7e5fa4988 | |||
041d70a301 | |||
b4d9bd502d | |||
124f3092fb | |||
a9b809f5e5 | |||
f43fd76baa | |||
1e766f4718 | |||
d8b09cb42e | |||
62e863e343 | |||
0a270c9218 | |||
a757232ec4 | |||
2d0a468395 | |||
e4762b80fa | |||
52ba9ff3a8 | |||
0aeff6118b | |||
84366812f9 | |||
984b76b170 | |||
19a3ba6f87 | |||
a39f39c692 | |||
e870271fe4 | |||
080578c101 | |||
d0d1c652fe | |||
0a1bef37fe | |||
2a825da32e | |||
e6f8947c08 | |||
15d35e5508 | |||
3f1bfc1c3c | |||
fdf75934e5 | |||
f603d87b33 | |||
bebca989d0 | |||
531797d348 | |||
2002b8b232 | |||
0e0a79c6cd | |||
0f52a875de | |||
70771e5ab5 | |||
447d926ca6 | |||
b4870a1814 | |||
6cf86bed47 | |||
c344720fa8 | |||
e57a52f10c | |||
5dbfde798b | |||
535e513078 | |||
b84006f8a4 | |||
6d7b5ee1fd | |||
8b1e4a1bf9 | |||
7903710d75 | |||
4c1235267c | |||
836dae756f | |||
00eed24232 | |||
0819d58ada | |||
5bb66f76c0 | |||
d1b0f5e6d9 | |||
a1722a87ae | |||
2fea5fa71d | |||
26cb855e9e | |||
4c33b8f005 | |||
4f0f31b0cc | |||
c351d71129 | |||
204bb80252 | |||
db9994b05a | |||
804a4738ea | |||
61f4be2eeb | |||
76626f3ac4 | |||
7524e6323f | |||
9b0b33d75b | |||
2cab1106f8 | |||
f5cd272957 | |||
fbbaf1cd7f | |||
ea258547d9 | |||
b38f006658 | |||
7ccb9cd1da | |||
04bcecad9e | |||
58b91fb1a8 | |||
dbad529313 | |||
e94a82e3d9 | |||
45cc299866 | |||
84e58bb9eb | |||
968859babe | |||
5961e436d5 | |||
7f1c0bc1d8 | |||
088634129e | |||
5cc72cd846 | |||
7612ce1e8b | |||
18368ef874 | |||
5b5016fedf | |||
4dd7353235 | |||
bd226c84a7 | |||
f5dd86284f | |||
d96066a4ea | |||
79b960ec34 | |||
c2ae054719 | |||
6cd5f1d041 | |||
d1cadd9df8 | |||
44dfb0021a | |||
442d8a4c39 | |||
4d15d50e12 | |||
96a54aa6bf | |||
aa71ff8761 | |||
e56e1c59b9 | |||
497e31b96f | |||
ecee97085d | |||
c7ca9b0801 | |||
42652b36ee | |||
ee25a01946 | |||
d4d02b967d | |||
486e14e10b | |||
5e5c6d57ea | |||
f7b6b5e305 | |||
f91f000405 | |||
a4932d08f1 | |||
d7e2cf8804 | |||
5850cb0669 | |||
0bcabbd4ff | |||
009015ce3c | |||
f3a63c9e46 | |||
86dc1b8a2b | |||
f14b44ecd0 | |||
55623410ab | |||
2043dbfce6 | |||
39f98229eb | |||
bc803b1547 | |||
834866663a | |||
70d24e17d8 | |||
848d1a9ddf | |||
87d2e85f70 | |||
6bc5c647a0 | |||
64babca37b | |||
16b7d97c75 | |||
921a16d471 | |||
1d3f2c303d | |||
58076d4e7b | |||
b46c4b3447 | |||
908d461552 | |||
02d80795ca | |||
2562c9a569 | |||
86aebbdc9c | |||
d1ddade1a0 | |||
2cc196225a | |||
a2009e41aa | |||
76224cda73 | |||
42dba1b6c1 | |||
efcb1620d6 | |||
ff2a72f112 | |||
c4b7a5c48d | |||
ae4de6bab7 | |||
4d9c285700 | |||
64febe48b0 | |||
c81f974ade | |||
e1812737bd | |||
8b607e2606 | |||
dac93a6206 | |||
6fe0dad775 | |||
ca9af3f5a0 | |||
00d1e3bdc4 | |||
610b5575a4 | |||
e02e4b3734 | |||
dabcca1517 | |||
deb5d1965b | |||
7e280e7804 | |||
3f8e74cdf6 | |||
ea44c7e621 | |||
855236d528 | |||
fd5ab73439 | |||
3e5854a0de | |||
ed3f9cf898 | |||
b00b753f27 | |||
a259f0d145 | |||
75f205a57b | |||
543795002b | |||
17259b9035 | |||
0c376bcf40 | |||
fe7339b851 | |||
2226220636 | |||
ad772c1aa8 | |||
5e39eb5723 | |||
e27757b98e | |||
7b4660d2c9 | |||
5aba610a4f | |||
84e0ad3792 | |||
fa17640f2b | |||
46fc23cd2d | |||
ce670869b3 | |||
80e90a5d5c | |||
007751dbee | |||
272366fbb1 | |||
e598321b52 | |||
bb1c9f7bf4 | |||
136cb32301 | |||
7e8a21ea2d | |||
8b77098b4e | |||
b72c2b5777 | |||
590f86f269 | |||
90f6159d30 | |||
74057ff813 | |||
cd093e73b2 | |||
c5f02ddd12 | |||
43c6f31a65 | |||
6ae7333dbb | |||
f3d3a7e575 | |||
a09295968e | |||
691d445ae0 | |||
0201ea64e6 | |||
79d4d64071 | |||
3095b46b2e | |||
a0389edcdc | |||
429e9c9315 | |||
97300bba09 | |||
a3d9a67ecc | |||
53c99266ea | |||
3fea28a830 | |||
c70092f18a | |||
fe6ae86415 | |||
60327521ef | |||
68b6bd45d8 | |||
e36e3f4bdd | |||
f944901c44 | |||
804042ce03 | |||
8e5c13e9ee | |||
7dc400431d | |||
73865c13fd | |||
16b9a4c94a | |||
365e434c98 | |||
d2a194416f | |||
4cbd67fc02 | |||
195435fe2a | |||
1c24ab4c01 | |||
387f327717 | |||
15a61e7d1d | |||
0291cba544 | |||
d96df43ac4 | |||
4620282d94 | |||
e7446ff913 | |||
fa6a70b07a | |||
978d10dda2 | |||
1164f2c74f | |||
a903346fdf | |||
d2c6a229bd | |||
123e845220 | |||
70dd95c098 | |||
49ddd341a0 | |||
06e8628e01 | |||
113fe437cf | |||
f6daca082c | |||
a3aee5c655 | |||
a008f339a0 | |||
fa7598bb52 | |||
e4b5f4742c | |||
80d1f8be1a | |||
66616e7314 | |||
dd0414bcd8 | |||
a66ecdbd26 | |||
37263c12f3 | |||
fedec6f6a2 | |||
f7555b6afb | |||
b4698d2eda | |||
f3943a9487 | |||
0f08e5891c | |||
c752c75c20 | |||
47881930d8 | |||
d5196ee508 | |||
d90719317e | |||
8a9bbc8190 | |||
c0dc1e2fba | |||
54868fedac |
53
.github/workflows/buildAndTest.yml
vendored
Normal file
53
.github/workflows/buildAndTest.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
name: Dotnet build and test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
logLevel:
|
||||
description: 'Log level'
|
||||
required: true
|
||||
default: 'warning'
|
||||
type: choice
|
||||
options:
|
||||
- info
|
||||
- warning
|
||||
- debug
|
||||
tags:
|
||||
description: 'Test scenario tags'
|
||||
required: false
|
||||
type: boolean
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
log-the-inputs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
echo "Log level: $LEVEL"
|
||||
echo "Tags: $TAGS"
|
||||
echo "Environment: $ENVIRONMENT"
|
||||
env:
|
||||
LEVEL: ${{ inputs.logLevel }}
|
||||
TAGS: ${{ inputs.tags }}
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
19
.gitignore
vendored
19
.gitignore
vendored
@ -5,14 +5,14 @@
|
||||
|
||||
.gitignore
|
||||
.paket/
|
||||
.vscode/
|
||||
.vs/
|
||||
.dnx/
|
||||
.sass-cache/
|
||||
.private/
|
||||
|
||||
/out
|
||||
bin
|
||||
obj
|
||||
bower_components
|
||||
project.lock.json
|
||||
node_modules/
|
||||
private/
|
||||
|
||||
@ -21,17 +21,24 @@ RSA-Params.json
|
||||
appsettings.*.json
|
||||
omnisharp.json
|
||||
|
||||
DataProtection/
|
||||
|
||||
/packages/
|
||||
/src/Yavsc/Avatars-*/
|
||||
/src/Yavsc/Blog-*/
|
||||
/src/Yavsc/Bills-*/
|
||||
/src/Yavsc/AppData*/
|
||||
/src/Yavsc/Temp-*/
|
||||
/src/Yavsc/*-Avatars/
|
||||
/src/Yavsc/bower_components/
|
||||
/src/Yavsc/AppData*/
|
||||
/src/Yavsc/Data-Dev/
|
||||
/src/test/testingrepo/
|
||||
connectionsettings.Development.json
|
||||
appsettings.Development.json
|
||||
/src/Yavsc/web.log
|
||||
yavscd
|
||||
/yavscd
|
||||
builds/
|
||||
/test/yavscTests/test-results.xml
|
||||
/test/yavscTests/test-results.html
|
||||
/binaries/Debug/yavscd
|
||||
yavsc-pre
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Machine.Specifications.Runner.Console" version="0.9.0" />
|
||||
</packages>
|
16
.travis.yml
16
.travis.yml
@ -1,16 +0,0 @@
|
||||
language: csharp
|
||||
os: linux
|
||||
mono:
|
||||
- beta
|
||||
sudo: false
|
||||
install:
|
||||
- curl --insecure -sSL https://lua.pschneider.fr/files/Paul/pub/dnx-install.sh | bash
|
||||
- DNX_USER_HOME=`pwd -P`/dnx . ./dnx/dnvm/dnvm.sh
|
||||
- cd src/OAuth.AspNet.Token && dnu restore --ignore-failed-sources
|
||||
- cd ../OAuth.AspNet.AuthServer && dnu restore --ignore-failed-sources
|
||||
- cd ../Yavsc.Abstract && dnu restore --ignore-failed-sources
|
||||
- cd ../Yavsc.Server && dnu restore --ignore-failed-sources
|
||||
- cd ../Yavsc && dnu restore --ignore-failed-sources
|
||||
script:
|
||||
- "dnu build"
|
||||
|
146
.vscode/launch.json
vendored
Normal file
146
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
{
|
||||
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
|
||||
// Pointez pour afficher la description des attributs existants.
|
||||
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "cli .NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/cli/bin/Debug/net9.0/cli.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"name": "C#: sampleWebAsWebApiClient Debug",
|
||||
"type": "dotnet",
|
||||
"request": "launch",
|
||||
"projectPath": "${workspaceFolder}/src/sampleWebAsWebApiClient/sampleWebAsWebApiClient.csproj"
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/Yavsc/bin/Debug/net9.0/Yavsc.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/Yavsc",
|
||||
"stopAtEntry": false,
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* {
|
||||
"name": ".NET Core Launch (web-client)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/sampleWebAsWebApiClient/bin/Debug/net8.0/sampleWebAsWebApiClient.dll>",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/sampleWebAsWebApiClient",
|
||||
"stopAtEntry": false,
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Launch (Api)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build-webapi",
|
||||
"program": "${workspaceFolder}/src/Api/bin/Debug/net8.0/Api.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/Api",
|
||||
"stopAtEntry": false,
|
||||
"console": "internalConsole"
|
||||
},
|
||||
*/
|
||||
{
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/Yavsc/bin/Debug/net9.0/Yavsc.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/Yavsc",
|
||||
"stopAtEntry": false,
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "webApi",
|
||||
"type": "dotnet",
|
||||
"request": "launch",
|
||||
"projectPath": "${workspaceFolder}/src/Api/Api.csproj"
|
||||
},
|
||||
{
|
||||
"name": "webClient",
|
||||
"type": "dotnet",
|
||||
"request": "launch",
|
||||
//"projectPath": "${workspaceFolder}/src/Yavsc/Yavsc.csproj",
|
||||
"projectPath": "${workspaceFolder}/src/sampleWebAsWebApiClient/sampleWebAsWebApiClient.csproj",
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "web",
|
||||
"type": "dotnet",
|
||||
"request": "launch",
|
||||
"projectPath": "${workspaceFolder}/src/Yavsc/Yavsc.csproj",
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"presentation": {
|
||||
"hidden": false,
|
||||
"group": "run",
|
||||
"order": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "web core",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/src/Yavsc/bin/Debug/net9.0/Yavsc.dll",
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"cwd": "${workspaceFolder}/src/Yavsc",
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
16
.vscode/settings.json
vendored
Normal file
16
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"dotnet-test-explorer.testProjectPath": "test/**/*Tests.csproj",
|
||||
|
||||
"cSpell.words": [
|
||||
"appsettings",
|
||||
"Cratie",
|
||||
"Newtonsoft",
|
||||
"Npgsql",
|
||||
"Yavsc"
|
||||
],
|
||||
"cSpell.dictionaries": [
|
||||
"fr"
|
||||
],
|
||||
"cSpell.reportUnknownWords": true,
|
||||
"cSpell.language": "fr,fr-FR,en,en-GB"
|
||||
}
|
97
.vscode/tasks.json
vendored
Normal file
97
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"/property:GenerateFullPaths=true"
|
||||
],
|
||||
"group": "build",
|
||||
"isBuildCommand": true,
|
||||
"isTestCommand": false
|
||||
},
|
||||
{
|
||||
"label": "build-web",
|
||||
"type": "process",
|
||||
"problemMatcher": ["$msCompile"],
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
"build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "src/Yavsc"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"isBackground": true
|
||||
},
|
||||
{
|
||||
"label": "build-webapi",
|
||||
"type": "process",
|
||||
"problemMatcher": ["$msCompile"],
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
"build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "src/Api"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"isBackground": true
|
||||
},
|
||||
{
|
||||
"label": "build-webclient",
|
||||
"type": "process",
|
||||
"problemMatcher": ["$msCompile"],
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
"build"
|
||||
],
|
||||
"runOptions": {
|
||||
},
|
||||
"options": {
|
||||
"cwd": "src/sampleWebAsWebApiClient"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
60
Directory.Packages.props
Normal file
60
Directory.Packages.props
Normal file
@ -0,0 +1,60 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="IdentityModel.OidcClient" Version="6.0.0" />
|
||||
<PackageVersion Include="AsciiDocNet" Version="1.0.0" />
|
||||
<PackageVersion Include="bootstrap" Version="5.3.7" />
|
||||
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
|
||||
<PackageVersion Include="Google.Apis.Calendar.v3" Version="1.69.0.3746" />
|
||||
<PackageVersion Include="Google.Apis.Compute.v1" Version="1.70.0.3871" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.AspNetIdentity" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.Storage" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.EntityFramework.Storage" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.EntityFramework" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.Security" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="IdentityModel.AspNetCore" Version="4.3.0" />
|
||||
<PackageVersion Include="MailKit" Version="4.13.0" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Antiforgery" Version="2.3.0" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Authentication.Google" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Hosting" Version="2.3.0" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Http.Features" Version="5.0.17" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Identity.UI" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Razor" Version="2.3.0" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.36" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.SignalR" Version="1.2.0" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.0" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageVersion Include="Microsoft.Playwright" Version="1.53.0" />
|
||||
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
|
||||
<PackageVersion Include="MimeKit" Version="4.13.0" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
<PackageVersion Include="PayPalMerchantSDK" Version="2.16.250" />
|
||||
<PackageVersion Include="pazof.rules" Version="1.1.3" />
|
||||
<PackageVersion Include="popper.js" Version="1.16.1" />
|
||||
<PackageVersion Include="RazorEngine.NetCore" Version="3.1.0" />
|
||||
<PackageVersion Include="Selenium.WebDriver" Version="4.34.0" />
|
||||
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.10" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="9.0.3" />
|
||||
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="9.0.7" />
|
||||
<PackageVersion Include="xunit" Version="2.9.3" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -8,12 +8,12 @@ In this doc, let's say, `FreeField`
|
||||
|
||||
### A domain name
|
||||
|
||||
Wait ... `freefield.pschneider.fr`
|
||||
Wait ... `pschneider.fr`
|
||||
You'll have to see with your provider, in order to power it, and make it point to your host ip, at least concerning the ports 80 & 443.
|
||||
|
||||
### An Npgsql db
|
||||
### A Postgresql db
|
||||
|
||||
The database must be created, and we need its connection string, allowed to modify the dd
|
||||
The database must be created, and we need its connection string, allowed to modify the data dictionary
|
||||
|
||||
### A mailling service
|
||||
|
||||
@ -24,5 +24,3 @@ You'll need to send e-mail ... using smtp and the provider of your choice.
|
||||
I'll have to make with it, a least a moment, it needs a *service account*, and some setup,
|
||||
in the `appsettings.*.json` file, and
|
||||
the execution environment variable GOOGLE_APPLICATION_CREDENTIALS to a value pointing the json description file for the Google Service account.
|
||||
|
||||
|
||||
|
237
LICENSE
237
LICENSE
@ -1,231 +1,14 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Preamble
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' aVVnd authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
|
77
Makefile
77
Makefile
@ -1,68 +1,37 @@
|
||||
LIBS:=$(shell ls private/lib/*.dll)
|
||||
MONO_PREFIX=/home/paul/mono46
|
||||
DNX_USER_HOME=/home/paul/.dnx
|
||||
DNXLIBS=Microsoft.Dnx.Host.Mono.dll Microsoft.Dnx.Host.dll Microsoft.Dnx.ApplicationHost.dll Microsoft.Dnx.Loader.dll Microsoft.Dnx.Compilation.Abstractions.dll Microsoft.Dnx.Compilation.CSharp.Abstractions.dll Microsoft.CodeAnalysis.dll Microsoft.CodeAnalysis.CSharp.dll Microsoft.Dnx.Compilation.CSharp.Common.dll Microsoft.Dnx.Compilation.CSharp.dll Microsoft.Dnx.Compilation.dll Microsoft.Dnx.Runtime.dll Microsoft.Dnx.Runtime.Internals.dll Microsoft.Extensions.PlatformAbstractions.dll System.Collections.Immutable.dll System.Reflection.Metadata.dll
|
||||
DNXLIBFP:=$(addprefix $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin/, $(DNXLIBS))
|
||||
|
||||
CONFIG=Debug
|
||||
FRAMEWORK=net8.0
|
||||
DESTDIR=/tmp/yavsc
|
||||
|
||||
git_status := $(shell git status -s --porcelain |wc -l)
|
||||
|
||||
all: yavscd
|
||||
all:
|
||||
@dotnet build --nologo 2>/dev/null |grep error
|
||||
|
||||
clean:
|
||||
rm -f src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll
|
||||
dotnet clean
|
||||
|
||||
checklibs:
|
||||
ls $(DNXLIBFP)
|
||||
|
||||
updatedeps:
|
||||
cp src/Yavsc/bin/output/approot/packages/*/*/lib/*net451*/*.dll private/lib/
|
||||
cp src/Yavsc/bin/output/approot/packages/*/*/lib/*dnx451*/*.dll private/lib/
|
||||
src/Yavsc/bin/output/wwwroot:
|
||||
dotnet --project src/Yavsc/Yavsc.csproj publish
|
||||
|
||||
test:
|
||||
make -C src/test
|
||||
dotnet test
|
||||
|
||||
web:
|
||||
make -C src/Yavsc web
|
||||
dotnet watch -p:Configuration=$(CONFIG) --project src/Yavsc/Yavsc.csproj
|
||||
|
||||
pushInPre: yavscd
|
||||
make -C src/Yavsc pushInPre
|
||||
src/Yavsc.Abstract/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.Abstract.dll:
|
||||
dotnet build -p:Configuration=$(CONFIG) --project src/Yavsc.Abstract/Yavsc.Abstract.csproj
|
||||
|
||||
pushInProd: yavscd
|
||||
make -C src/Yavsc pushInProd
|
||||
src/Yavsc.Server/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.Server.dll:
|
||||
dotnet build -p:Configuration=$(CONFIG) --project src/Yavsc.Server/Yavsc.Server.csproj
|
||||
|
||||
packages:
|
||||
make -C src/Yavsc.Abstract pack
|
||||
|
||||
findResources:
|
||||
find src -name "*.resx" |sort
|
||||
|
||||
prepare_all_code:
|
||||
make -C src/Yavsc.Abstract prepare_code
|
||||
make -C src/Yavsc.Server prepare_code
|
||||
make -C src/Yavsc prepare_code
|
||||
|
||||
src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll: prepare_all_code
|
||||
make -C src/Yavsc.Abstract CONFIGURATION=$(CONFIG)
|
||||
|
||||
src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll: prepare_all_code
|
||||
make -C src/OAuth.AspNet.Token CONFIGURATION=$(CONFIG)
|
||||
|
||||
src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll: prepare_all_code
|
||||
make -C src/OAuth.AspNet.AuthServer CONFIGURATION=$(CONFIG)
|
||||
|
||||
src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll: src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll prepare_all_code
|
||||
make -C src/Yavsc.Server CONFIGURATION=$(CONFIG)
|
||||
|
||||
src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll: src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll
|
||||
make -C src/Yavsc CONFIGURATION=$(CONFIG)
|
||||
|
||||
yavscd: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll
|
||||
mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd
|
||||
strip yavscd
|
||||
|
||||
version-increment-patch:
|
||||
scripts/version.sh $$(cat version.txt) patch > version.txt
|
||||
src/Yavsc/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.dll:
|
||||
dotnet build -p:Configuration=$(CONFIG) --project src/Yavsc/Yavsc.csproj
|
||||
|
||||
|
||||
.PHONY: packages
|
||||
publish:
|
||||
dotnet publish src/Yavsc/Yavsc.csproj -c Release -o $(DESTDIR)/srv/www/yavsc
|
||||
|
||||
install: publish
|
||||
sudo chown -R www-data:www-data $(DESTDIR)/srv/www/yavsc
|
||||
|
||||
.PHONY:
|
||||
|
72
README.md
72
README.md
@ -1,4 +1,6 @@
|
||||
|
||||
|
||||
[](http://gitlab.pschneider.fr/Paul/yavsc/-/commits/vnext)
|
||||
[](https://travis-ci.org/pazof/yavsc)
|
||||
|
||||
# [Yavsc](https://yavsc.pschneider.fr)
|
||||
@ -9,78 +11,36 @@ C'est une application mettant en oeuvre une prise de contact entre un demandeur
|
||||
|
||||
## Construction
|
||||
|
||||
Le code est du c sharp, dont les librairies sont restorées et le tout compilé avec les librairies DNX de M$, téléchargeable en executant le script d'installation suivant (c.f. `/.travis.yml`):
|
||||
|
||||
curl --insecure -sSL https://lua.pschneider.fr/files/Paul/dnx-install.sh | bash && DNX_USER_HOME=`pwd -P`/dnx . ./dnx/dnvm/dnvm.sh && cd Yavsc && dnu restore
|
||||
|
||||
Une fois l'environnement ainsi pollué, executer, depuis le sous dossier `Yavsc`:
|
||||
|
||||
dnu build
|
||||
|
||||
L'utilisation du serveur web, avec un runtime Mono, échoura dans ses version récentes (à peu près supérieure ou égale à 4.7).
|
||||
|
||||
La version 4.6.2 de mono convient:
|
||||
|
||||
[monoperso] ~/workspace/yavsc/Yavsc @ mono --version
|
||||
Mono JIT compiler version 4.6.2 (Stable 4.6.2.7/08fd525 jeudi 18 janvier 2018, 13:10:54 (UTC+0100))
|
||||
TLS: __thread
|
||||
SIGSEGV: altstack
|
||||
Notifications: epoll
|
||||
Architecture: amd64
|
||||
Disabled: none
|
||||
Misc: softdebug
|
||||
LLVM: supported, not enabled.
|
||||
GC: sgen
|
||||
|
||||
```bash
|
||||
dotnet build
|
||||
```
|
||||
|
||||
et, pour execution en environement de développement
|
||||
|
||||
[monoperso] ~/workspace/yavsc/Yavsc @ ASPNET_ENV=Development dnx web
|
||||
warn: Yavsc.Startup[0]
|
||||
AppData was not found in environment variables
|
||||
warn: Yavsc.Startup[0]
|
||||
It has been set to : /home/paul/workspace/yavsc/Yavsc/AppDataDevelopment
|
||||
Hosting environment: Development
|
||||
Now listening on: http://*:5000
|
||||
Application started. Press Ctrl+C to shut down.
|
||||
|
||||
Si vous êtes arrivé jusqu'ici, vous devriez pouvoir visiter la home page
|
||||
[ici](http://localhost:5000).
|
||||
```bash
|
||||
~/workspace/yavsc/Yavsc @ ASPNETCORE_ENV=Development dotnet run
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Utilisez GNU/Makefile (et visitez le code, dans le dossier `test` ):
|
||||
|
||||
Depuis le répertoire racine:
|
||||
[TODO] Depuis le répertoire racine:
|
||||
|
||||
```
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
## Installation / Déploiment / Développement
|
||||
## Installation / Déploiment / Développement
|
||||
|
||||
### les services kestrel et kestrel-pre
|
||||
|
||||
[TODO]
|
||||
|
||||
### la configuration Apache 2
|
||||
|
||||
[TODO]
|
||||
|
||||
### la mise en pré-production
|
||||
|
||||
Pour déployer le tout en production, on peut d'abord déployer en "pré-production",
|
||||
Afin de pouvoir tester manuellement quelque dernier développement :
|
||||
|
||||
```
|
||||
cd Yavsc
|
||||
make pushInPre # arrete kestrel-pre, pousse tout dans DESTDIR=/srv/www/yavscpre avec rsync,
|
||||
# et redemarre kestrel-pre
|
||||
```
|
||||
### les services et l'API
|
||||
|
||||
### La Prod
|
||||
|
||||
Une fois sûr de vous, et une fois que Git dit propre votre copie de travail, depuis le répertoire `Yavsc`, lancez `make pushInProd`.
|
||||
`cd srv/Yavsc` : `make pushInProd CONFIGURATION=Release`.
|
||||
|
||||
puis, pour une première installation
|
||||
`make install_service`.
|
||||
|
||||
## Fonctionalités (encore en cours de développement)
|
||||
|
||||
|
10
SECURITY.md
10
SECURITY.md
@ -1,10 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.0.6 | :x: |
|
||||
|
||||
(https://yavsc.pschneider.fr)
|
161
TODO.fr.md
Normal file
161
TODO.fr.md
Normal file
@ -0,0 +1,161 @@
|
||||
# Yavsc.vNext
|
||||
|
||||
Da road to the hell
|
||||
|
||||
Ceci est une grosse liste de fonctionnalités, existantes, ou à implémenter, ou à oublier ...
|
||||
|
||||
## Jalon 1
|
||||
|
||||
☐ Des spécifications détaillées du coeur de l'application
|
||||
✔ Acces (publique) aux Blogs. @done (August 13th 2016, 0:51)
|
||||
✔ Accès aux profiles des intervenants. @done (August 13th 2016, 0:57)
|
||||
✔ Demande de devis, spécifiant une date et un lieu, envers un pro (ou "BookQuery", ou "demande de rendez-vous"). @done (August 13th 2016, 0:57)
|
||||
✔ Notifications commande. @done (September 15th 2016, 15:00)
|
||||
✔ Rendu Html du format Markdown-av (+audio&video). @done (October 6th 2016, 14:32)
|
||||
✔ Rendu Android, via WebKit WebView. @done (October 6th 2016, 14:32)
|
||||
✔ Salon public. @done (September 28th 2016, 17:58)
|
||||
✔ Saisie et soumission basique du devis. @done (October 30th 2016, 21:50)
|
||||
✔ Devis au formats TeX et Pdf en ligne à accès restreint. @done (November 6th 2016, 2:10)
|
||||
✔ Idem depuis l'API web. @done (November 10th 2016, 10:00)
|
||||
✔ Signature du devis par le fournisseur (l'arstiste), depuis le mobile. @done (December 7th 2016, 10:45)
|
||||
☐ Au devis validé par le fournisseur pour le client : Envoi d'une notification au client et mise à disposition du devis signé
|
||||
* à l'accord du client sur le devis :
|
||||
☐ Envoi d'une notification au fournisseur et mise à disposition de la signature client et d'un commentaire.
|
||||
☐ Edition de la facture non aquittée depuis le mobile.
|
||||
☐ Edition de contrat depuis le mobile.
|
||||
☐ Notification et mise à disposition du contrat pour le client.
|
||||
☐ Signature de contrat par le client.
|
||||
☐ Notification au client de la facture non aquittée.
|
||||
(+ ☐ Paiement du client?)
|
||||
☐ Edition de la facture marquée aquitée et signée par le fournisseur.
|
||||
☐ Notification au client de la facture aquittée signée.
|
||||
✔ Chat privé (coté serveur). @done (October 13th 2016, 16:27)
|
||||
✔ Accès mobile au salon public. @done (October 13th 2016, 16:27)
|
||||
✔ Accès Web au chat privé. @done (November 3rd 2016, 14:57)
|
||||
✔ Accès mobile au chat privé. @done (November 3rd 2016, 11:15)
|
||||
✔ Envoi de l'avatar. @done (December 7th 2016, 10:45)
|
||||
✔ Envoi de l'avatar depuis le mobile. @done (May 31st 2017, 3:19)
|
||||
* Gestion du profile utilisateur:
|
||||
✔ Simple [Web] @done (May 31st 2017, 3:19)
|
||||
✔ Prestataire [Web] @done (May 31st 2017, 3:19)
|
||||
☐ Simple [Android]
|
||||
☐ Prestataire [Android]
|
||||
* Gestion de l'espace de stockage personnel:
|
||||
☐ Depuis le Web.
|
||||
☐ Depuis l'API web.
|
||||
☐ Depuis le Mobile.
|
||||
☐ Gestion de l'espace de stockage personnel, depuis l'API Web.
|
||||
✔ Envoi de fichiers depuis de Web. @done (December 7th 2016, 10:45)
|
||||
☐ Évaluation de la prestation.
|
||||
☐ Creation d'une annonce
|
||||
☐ Transformation d'une annonce en demande nominative, et inversement
|
||||
|
||||
☐ Page d'accueil du mobile: Les alertes, et les derniers événements, donc, les derniers post, les
|
||||
dernières inscriptions de prestataire, les annonces
|
||||
* La sélection d'une star:
|
||||
☐ delegation du traitement des demandes
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (May 31st 2017, 3:25)
|
||||
* La sélection d'un DJ: (rechercher dans / afficher) les samples + idem chanteur
|
||||
les critères : la date, les champs du formulaire de commande: le message, le lieu, la tendance musicale
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (September 25th 2017, 17:31)
|
||||
* La sélection d'un chanteur: (rechercher dans / afficher) les titres du répertoire
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (September 25th 2017, 17:31)
|
||||
* La sélection d'une formation musicale: idem chanteur + (rechercher/afficher) la taille de la formation
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (September 25th 2017, 17:31)
|
||||
* Géocodeur de lieu
|
||||
✔ Web @done (May 31st 2017, 3:20)
|
||||
☐ Mobile
|
||||
* Géocodeur adresse postale
|
||||
☐ Web
|
||||
☐ Mobile
|
||||
☐ Evaluation des trajets
|
||||
✔ Réactivation des cercles privés (cassé avec vNext) @done (May 31st 2017, 3:22)
|
||||
✔ Support multi-lanque de l'app mobile @done (December 7th 2016, 10:58)
|
||||
✔ Support multi-lanque du web @done (December 7th 2016, 10:58)
|
||||
|
||||
## Jalon 2
|
||||
|
||||
|
||||
☐ Interface de gestion des collaborateurs
|
||||
☐ Migration de l'identifiant utilisateur, de la chaine de caractère ala GUID vers l'entier long auto incrémenté par Npgsql
|
||||
|
||||
☐ Login with Twitter
|
||||
☐ Login with PayPal
|
||||
|
||||
☐ Contrôle Web du rating
|
||||
|
||||
☐ Paiement client d'un approvisionnement pour une demande de prestation définie.
|
||||
☐ La saisie et l'usage des disonibilités, les ponctuelles, les réccurentes, et les périodes de congé.
|
||||
☐ Notifications structurelles (liste de notifications impératives, relatives au site,
|
||||
spécifiées par groupe d'utilisateurs).
|
||||
☐ Notifications aux posts, à l'entée d'un artiste, à la conclusion d'une success story.
|
||||
☐ Construction du droit à l'envoi d'un message privé, spécifié par le destinataire
|
||||
et/ou par accréditation administrative, à un utilisateur spécifié, ou
|
||||
à un cercle ou à un groupe, de manière temporaire ou définitive, par une plage de temps spécifié
|
||||
ou par la validité d'une demande de devis ou une intervention en cours ou récente ou à venir.
|
||||
☐ Paiement client du reste de la prestation.
|
||||
☐ Podcasts.
|
||||
☐ Personalisation des blogs.
|
||||
☐ Monétarisations.
|
||||
☐ Distribution de gold card (illimité), de carte vertes (à durée fixe),
|
||||
de la part d'un prestataire, donnant accès au destinataire au chat privé.
|
||||
☐ La carte blanche: en la confiant, le prestataire délègue la gestion de son agenda à un autre utilisateur,
|
||||
elle implique le droit au chat privé
|
||||
☐ de badges temporaires, donnant accès à un téléchargement unique et limité dans le temps, d'un seul fichier,
|
||||
sans autre forme d'autorisation.
|
||||
|
||||
### Réécritures prévues :
|
||||
|
||||
☐ Eviter la création de fichier TeX inutile à la génération du Pdf
|
||||
|
||||
### Accessibilité :
|
||||
☐ Correction des libéllés manquant et/ou en anglais relevés avant le jalon 2
|
||||
|
||||
### Sécurité
|
||||
☐ Quota fs utilisateur
|
||||
☐ Usage de clés anti-forge coté interfaces Web
|
||||
☐ Fixer "là où ça manque" les limitations en taille des chaines de caratères du modèle
|
||||
|
||||
### Configurabilité
|
||||
☐ Gestion de contenu des pages du site, au format interne (NRLD: i.e. non exposé,
|
||||
absent du code livré aux clients Web) Markdown-av (`@Html.SiteContent<AccessRules>(id).Responsible`)
|
||||
|
||||
## Jalon 3
|
||||
|
||||
☐ Saisie du devis sur commande générique: les commandes sont des projets utilisateur associés
|
||||
à une liste de formulaire de prise de commande auprès de services que le producteur peut spécialiser,
|
||||
par l'ajout de groupes de champs de saisie complètement définis :
|
||||
☐ Chaque champ possède:
|
||||
☐ Un label
|
||||
☐ Un type pour la valeur
|
||||
☐ Un type de controle
|
||||
☐ Une liste de validateurs
|
||||
☐ Une invitation à la saisie
|
||||
|
||||
☐ Chaque champ apparait dans un groupe de champ possèdant un titre
|
||||
☐ Saisie d'un devis à destination d'un invité (envoi par email, contact local)
|
||||
☐ Paiement d'Arrhes
|
||||
|
||||
## Jalon 4
|
||||
|
||||
☐ Aide à la rencontre physique, avec une carte interactive des positions
|
||||
des participants, du geofencing pour les alerter de la rencontre, et plus si affinités.
|
||||
☐ Activités secondaires: Une activité peut se spécialiser, on le materialise dans le modèle
|
||||
en l'enregistrant comme activité fille. Par ailleurs, l'utilisateur peut déclarer plusieurs activités,
|
||||
sous la forme d'une liste, dont le premier élément indique l'activité principale
|
||||
(pour laquelle un code APE doit correspondre).
|
||||
☐ Le streaming vidéo, de pair à pair
|
||||
☐ Le streaming vidéo public.
|
||||
|
||||
## Jalon 5
|
||||
|
||||
☐ Conciliation: Une aide à la décision en cas de conflit entre fournisseur et client:
|
||||
à partir du dossier de la commande, on peut aider, en tant que personne du milieu, qui a accès aux deux vues du dossier,
|
||||
celle du client et celle du fournisseur, des indicateurs peuvent aider un membre de l'équipe commerciale (du groupe "FrontOffice")
|
||||
à choisir où se place la part de chacun dans l'échec du projet, et à en faire part au bélligérants dans l'espoir d'un accord.
|
||||
☐ Le réseau pro : on a des sous-traitants, on leur transmet des demandes de devis en tant que sous-traitance
|
||||
d'une demande en cours, cette dernière n'est validable qu'une fois seulement que tous les devis dont elle dépend sont validés.
|
162
TODO.md
162
TODO.md
@ -1,162 +0,0 @@
|
||||
# Yavsc.vNext
|
||||
|
||||
Da road to the hell
|
||||
|
||||
Ceci est une grosse liste de fonctionnalités, existantes, ou à implémenter, ou à oublier ...
|
||||
|
||||
## Jalon 1
|
||||
|
||||
☐ Redirection vers la Page d'accueil à la validation du second facteur (evitera l'erreur Anti-forgery token)
|
||||
☐ Des spécifications détaillées du coeur de l'application
|
||||
✔ Acces (publique) aux Blogs. @done (August 13th 2016, 0:51)
|
||||
✔ Accès aux profiles des intervenants. @done (August 13th 2016, 0:57)
|
||||
✔ Demande de devis, spécifiant une date et un lieu, envers un pro (ou "BookQuery", ou "demande de rendez-vous"). @done (August 13th 2016, 0:57)
|
||||
✔ Notifications commande. @done (September 15th 2016, 15:00)
|
||||
✔ Rendu Html du format Markdown-av (+audio&video). @done (October 6th 2016, 14:32)
|
||||
✔ Rendu Android, via WebKit WebView. @done (October 6th 2016, 14:32)
|
||||
✔ Salon public. @done (September 28th 2016, 17:58)
|
||||
✔ Saisie et soumission basique du devis. @done (October 30th 2016, 21:50)
|
||||
✔ Devis au formats TeX et Pdf en ligne à accès restreint. @done (November 6th 2016, 2:10)
|
||||
✔ Idem depuis l'API web. @done (November 10th 2016, 10:00)
|
||||
✔ Signature du devis par le fournisseur (l'arstiste), depuis le mobile. @done (December 7th 2016, 10:45)
|
||||
☐ Au devis validé par le fournisseur pour le client : Envoi d'une notification au client et mise à disposition du devis signé
|
||||
* à l'accord du client sur le devis :
|
||||
☐ Envoi d'une notification au fournisseur et mise à disposition de la signature client et d'un commentaire.
|
||||
☐ Edition de la facture non aquittée depuis le mobile.
|
||||
☐ Edition de contrat depuis le mobile.
|
||||
☐ Notification et mise à disposition du contrat pour le client.
|
||||
☐ Signature de contrat par le client.
|
||||
☐ Notification au client de la facture non aquittée.
|
||||
(+ ☐ Paiement du client?)
|
||||
☐ Edition de la facture marquée aquitée et signée par le fournisseur.
|
||||
☐ Notification au client de la facture aquittée signée.
|
||||
✔ Chat privé (coté serveur). @done (October 13th 2016, 16:27)
|
||||
✔ Accès mobile au salon public. @done (October 13th 2016, 16:27)
|
||||
✔ Accès Web au chat privé. @done (November 3rd 2016, 14:57)
|
||||
✔ Accès mobile au chat privé. @done (November 3rd 2016, 11:15)
|
||||
✔ Envoi de l'avatar. @done (December 7th 2016, 10:45)
|
||||
✔ Envoi de l'avatar depuis le mobile. @done (May 31st 2017, 3:19)
|
||||
* Gestion du profile utilisateur:
|
||||
✔ Simple [Web] @done (May 31st 2017, 3:19)
|
||||
✔ Prestataire [Web] @done (May 31st 2017, 3:19)
|
||||
☐ Simple [Android]
|
||||
☐ Prestataire [Android]
|
||||
* Gestion de l'espace de stockage personnel:
|
||||
☐ Depuis le Web.
|
||||
☐ Depuis l'API web.
|
||||
☐ Depuis le Mobile.
|
||||
☐ Gestion de l'espace de stockage personnel, depuis l'API Web.
|
||||
✔ Envoi de fichiers depuis de Web. @done (December 7th 2016, 10:45)
|
||||
☐ Évaluation de la prestation.
|
||||
☐ Creation d'une annonce
|
||||
☐ Transformation d'une annonce en demande nominative, et inversement
|
||||
|
||||
☐ Page d'accueil du mobile: Les alertes, et les derniers événements, donc, les derniers post, les
|
||||
dernières inscriptions de prestataire, les annonces
|
||||
* La sélection d'une star:
|
||||
☐ delegation du traitement des demandes
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (May 31st 2017, 3:25)
|
||||
* La sélection d'un DJ: (rechercher dans / afficher) les samples + idem chanteur
|
||||
les critères : la date, les champs du formulaire de commande: le message, le lieu, la tendance musicale
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (September 25th 2017, 17:31)
|
||||
* La sélection d'un chanteur: (rechercher dans / afficher) les titres du répertoire
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (September 25th 2017, 17:31)
|
||||
* La sélection d'une formation musicale: idem chanteur + (rechercher/afficher) la taille de la formation
|
||||
☐ depuis le mobile
|
||||
✔ depuis le Web @done (September 25th 2017, 17:31)
|
||||
* Géocodeur de lieu
|
||||
✔ Web @done (May 31st 2017, 3:20)
|
||||
☐ Mobile
|
||||
* Géocodeur adresse postale
|
||||
☐ Web
|
||||
☐ Mobile
|
||||
☐ Evaluation des trajets
|
||||
✔ Réactivation des cercles privés (cassé avec vNext) @done (May 31st 2017, 3:22)
|
||||
✔ Support multi-lanque de l'app mobile @done (December 7th 2016, 10:58)
|
||||
✔ Support multi-lanque du web @done (December 7th 2016, 10:58)
|
||||
|
||||
## Jalon 2
|
||||
|
||||
|
||||
☐ Interface de gestion des collaborateurs
|
||||
☐ Migration de l'identifiant utilisateur, de la chaine de caractère ala GUID vers l'entier long auto incrémenté par Npgsql
|
||||
|
||||
☐ Login with Twitter
|
||||
☐ Login with PayPal
|
||||
|
||||
☐ Contrôle Web du rating
|
||||
|
||||
☐ Paiement client d'un approvisionnement pour une demande de prestation définie.
|
||||
☐ La saisie et l'usage des disonibilités, les ponctuelles, les réccurentes, et les périodes de congé.
|
||||
☐ Notifications structurelles (liste de notifications impératives, relatives au site,
|
||||
spécifiées par groupe d'utilisateurs).
|
||||
☐ Notifications aux posts, à l'entée d'un artiste, à la conclusion d'une success story.
|
||||
☐ Construction du droit à l'envoi d'un message privé, spécifié par le destinataire
|
||||
et/ou par accréditation administrative, à un utilisateur spécifié, ou
|
||||
à un cercle ou à un groupe, de manière temporaire ou définitive, par une plage de temps spécifié
|
||||
ou par la validité d'une demande de devis ou une intervention en cours ou récente ou à venir.
|
||||
☐ Paiement client du reste de la prestation.
|
||||
☐ Podcasts.
|
||||
☐ Personalisation des blogs.
|
||||
☐ Monétarisations.
|
||||
☐ Distribution de gold card (illimité), de carte vertes (à durée fixe),
|
||||
de la part d'un prestataire, donnant accès au destinataire au chat privé.
|
||||
☐ La carte blanche: en la confiant, le prestataire délègue la gestion de son agenda à un autre utilisateur,
|
||||
elle implique le droit au chat privé
|
||||
☐ de badges temporaires, donnant accès à un téléchargement unique et limité dans le temps, d'un seul fichier,
|
||||
sans autre forme d'autorisation.
|
||||
|
||||
### Réécritures prévues :
|
||||
|
||||
☐ Eviter la création de fichier TeX inutile à la génération du Pdf
|
||||
|
||||
### Accessibilité :
|
||||
☐ Correction des libéllés manquant et/ou en anglais relevés avant le jalon 2
|
||||
|
||||
### Sécurité
|
||||
☐ Quota fs utilisateur
|
||||
☐ Usage de clés anti-forge coté interfaces Web
|
||||
☐ Fixer "là où ça manque" les limitations en taille des chaines de caratères du modèle
|
||||
|
||||
### Configurabilité
|
||||
☐ Gestion de contenu des pages du site, au format interne (NRLD: i.e. non exposé,
|
||||
absent du code livré aux clients Web) Markdown-av (`@Html.SiteContent<AccessRules>(id).Responsible`)
|
||||
|
||||
## Jalon 3
|
||||
|
||||
☐ Saisie du devis sur commande générique: les commandes sont des projets utilisateur associés
|
||||
à une liste de formulaire de prise de commande auprès de services que le producteur peut spécialiser,
|
||||
par l'ajout de groupes de champs de saisie complètement définis :
|
||||
☐ Chaque champ possède:
|
||||
☐ Un label
|
||||
☐ Un type pour la valeur
|
||||
☐ Un type de controle
|
||||
☐ Une liste de validateurs
|
||||
☐ Une invitation à la saisie
|
||||
|
||||
☐ Chaque champ apparait dans un groupe de champ possèdant un titre
|
||||
☐ Saisie d'un devis à destination d'un invité (envoi par email, contact local)
|
||||
☐ Paiement d'Arrhes
|
||||
|
||||
## Jalon 4
|
||||
|
||||
☐ Aide à la rencontre physique, avec une carte interactive des positions
|
||||
des participants, du geofencing pour les alerter de la rencontre, et plus si affinités.
|
||||
☐ Activités secondaires: Une activité peut se spécialiser, on le materialise dans le modèle
|
||||
en l'enregistrant comme activité fille. Par ailleurs, l'utilisateur peut déclarer plusieurs activités,
|
||||
sous la forme d'une liste, dont le premier élément indique l'activité principale
|
||||
(pour laquelle un code APE doit correspondre).
|
||||
☐ Le streaming vidéo, de pair à pair
|
||||
☐ Le streaming vidéo public.
|
||||
|
||||
## Jalon 5
|
||||
|
||||
☐ Conciliation: Une aide à la décision en cas de conflit entre fournisseur et client:
|
||||
à partir du dossier de la commande, on peut aider, en tant que personne du milieu, qui a accès aux deux vues du dossier,
|
||||
celle du client et celle du fournisseur, des indicateurs peuvent aider un membre de l'équipe commerciale (du groupe "FrontOffice")
|
||||
à choisir où se place la part de chacun dans l'échec du projet, et à en faire part au bélligérants dans l'espoir d'un accord.
|
||||
☐ Le réseau pro : on a des sous-traitants, on leur transmet des demandes de devis en tant que sous-traitance
|
||||
d'une demande en cours, cette dernière n'est validable qu'une fois seulement que tous les devis dont elle dépend sont validés.
|
165
assets/dnx_xunit_to_html.xsl
Normal file
165
assets/dnx_xunit_to_html.xsl
Normal file
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html"/>
|
||||
<xsl:template match="/">
|
||||
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]></xsl:text>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
xUnit.net Test Results - <xsl:value-of select="@name"/>
|
||||
</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; }
|
||||
h2,h3,h4,h5 { margin: 0; padding: 0; }
|
||||
h3 { font-weight: normal; }
|
||||
h5 { font-weight: normal; font-style: italic; margin-bottom: 0.75em; }
|
||||
pre { font-family: Consolas; font-size: 85%; margin: 0 0 0 1em; padding: 0; }
|
||||
.divided { border-top: solid 1px #f0f5fa; padding-top: 0.5em; }
|
||||
.row, .altrow { padding: 0.1em 0.3em; }
|
||||
.row { background-color: #f0f5fa; }
|
||||
.altrow { background-color: #e1ebf4; }
|
||||
.success, .failure, .skipped { font-family: Arial Unicode MS; font-weight: normal; float: left; width: 1em; display: block; }
|
||||
.success { color: #0c0; }
|
||||
.failure { color: #c00; }
|
||||
.skipped { color: #cc0; }
|
||||
.timing { float: right; }
|
||||
.indent { margin: 0.25em 0 0.5em 2em; }
|
||||
.indenttest { margin: 0.25em 0 0.5em 1em; }
|
||||
.clickable { cursor: pointer; }
|
||||
.testcount { font-size: 85%; }
|
||||
</style>
|
||||
<script language="javascript">
|
||||
function ToggleClass(id) {
|
||||
var elem = document.getElementById(id);
|
||||
if (elem.style.display == "none") {
|
||||
elem.style.display = "block";
|
||||
}
|
||||
else {
|
||||
elem.style.display = "none";
|
||||
}
|
||||
}
|
||||
function EnsureBlock(id) {
|
||||
var elem = document.getElementById(id);
|
||||
if (elem.style.display == "none") {
|
||||
elem.style.display = "block";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h3 class="divided"><b>Assemblies Run</b></h3>
|
||||
<xsl:apply-templates select="//assembly"/>
|
||||
|
||||
<h3 class="divided"><b>Summary</b></h3>
|
||||
<div>
|
||||
Tests run: <a href="#all"><b><xsl:value-of select="sum(//assembly/@total)"/></b></a>  
|
||||
Failures: <a href="#failures"><b><xsl:value-of select="sum(//assembly/@failed)"/></b></a>,
|
||||
Skipped: <a href="#skipped"><b><xsl:value-of select="sum(//assembly/@skipped)"/></b></a>,
|
||||
Run time: <b><xsl:value-of select="sum(//assembly/@time)"/>s</b>
|
||||
</div>
|
||||
<xsl:if test="//assembly/collection/test[@result='Fail']">
|
||||
<br />
|
||||
<h2><a name="failures"></a>Failed tests</h2>
|
||||
<xsl:apply-templates select="//assembly/collection/test[@result='Fail']"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
</xsl:if>
|
||||
<xsl:if test="//assembly/collection/failure">
|
||||
<br />
|
||||
<h2><a name="failures"></a>Failed fixtures</h2>
|
||||
<xsl:apply-templates select="//assembly/collection/failure"><xsl:sort select="../@name"/></xsl:apply-templates>
|
||||
</xsl:if>
|
||||
<xsl:if test="//assembly/@skipped > 0">
|
||||
<br />
|
||||
<h2><a name="skipped"></a>Skipped tests</h2>
|
||||
<xsl:apply-templates select="//assembly/collection/test[@result='Skip']"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
</xsl:if>
|
||||
<br />
|
||||
<h2><a name="all"></a>All tests</h2>
|
||||
<h5>Click test collection name to expand/collapse test details</h5>
|
||||
<xsl:apply-templates select="//assembly/collection"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="assembly">
|
||||
<div><xsl:value-of select="@name"/></div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="test">
|
||||
|
||||
<div>
|
||||
<xsl:attribute name="class"><xsl:if test="(position() mod 2 = 0)">alt</xsl:if>row</xsl:attribute>
|
||||
|
||||
<xsl:if test="@result!='Skip'"><span class="timing"><xsl:value-of select="@time"/>s</span></xsl:if>
|
||||
<xsl:if test="@result='Skip'"><span class="timing">Skipped</span><span class="skipped">❢</span></xsl:if>
|
||||
<xsl:if test="@result='Fail'"><span class="failure">✘</span></xsl:if>
|
||||
<xsl:if test="@result='Pass'"><span class="success">✔</span></xsl:if>
|
||||
<span class="clickable">
|
||||
<xsl:attribute name="onclick">ToggleClass('test<xsl:value-of select="generate-id()"/>')</xsl:attribute>
|
||||
 <xsl:value-of select="@name"/>
|
||||
</span>
|
||||
|
||||
|
||||
<div >
|
||||
|
||||
<xsl:if test="@result='Pass'"><xsl:attribute name="style">display: none;</xsl:attribute></xsl:if>
|
||||
<xsl:attribute name="id">test<xsl:value-of select="generate-id()"/></xsl:attribute>
|
||||
|
||||
<xsl:if test="child::node()/message"> : <xsl:value-of select="child::node()/message"/></xsl:if>
|
||||
<br clear="all" />
|
||||
<xsl:if test="failure/stack-trace">
|
||||
<pre><xsl:value-of select="failure/stack-trace"/></pre>
|
||||
</xsl:if>
|
||||
<xsl:if test="output">
|
||||
<h4>Output</h4>
|
||||
<pre><xsl:value-of select="output"/></pre>
|
||||
</xsl:if>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="failure">
|
||||
<span class="failure">✘</span> <xsl:value-of select="../@name"/> : <xsl:value-of select="message"/><br clear="all"/>
|
||||
Stack Trace:<br />
|
||||
<pre><xsl:value-of select="stack-trace"/></pre>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="collection">
|
||||
<h3>
|
||||
<span class="timing"><xsl:value-of select="@time"/>s</span>
|
||||
<span class="clickable">
|
||||
<xsl:attribute name="onclick">ToggleClass('collection<xsl:value-of select="generate-id()"/>')</xsl:attribute>
|
||||
<xsl:attribute name="ondblclick">ToggleClass('collection<xsl:value-of select="generate-id()"/>')</xsl:attribute>
|
||||
<xsl:if test="@failed > 0"><span class="failure">✘</span></xsl:if>
|
||||
<xsl:if test="@failed = 0"><span class="success">✔</span></xsl:if>
|
||||
 <xsl:value-of select="@name"/>
|
||||
 <span class="testcount">(<xsl:value-of select="@total"/> test<xsl:if test="@total > 1">s</xsl:if>)</span>
|
||||
</span>
|
||||
<br clear="all" />
|
||||
</h3>
|
||||
<div class="indent">
|
||||
<xsl:if test="@failed = 0"><xsl:attribute name="style">display: none;</xsl:attribute></xsl:if>
|
||||
<xsl:attribute name="id">collection<xsl:value-of select="generate-id()"/></xsl:attribute>
|
||||
|
||||
|
||||
<xsl:for-each select="test">
|
||||
<div class="indent">
|
||||
<xsl:if test="@result ='Fail'">
|
||||
<a>
|
||||
<xsl:attribute name="onclick">EnsureBlock('test<xsl:value-of select="generate-id()"/>')</xsl:attribute>
|
||||
<xsl:attribute name="href">#test<xsl:value-of select="generate-id()"/></xsl:attribute>
|
||||
<span class="failure">✘</span>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</xsl:if>
|
||||
<xsl:if test="@result ='Pass'">
|
||||
<span class="success">✔</span>
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
131
contrib/kestrel
131
contrib/kestrel
@ -1,131 +0,0 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kestrel
|
||||
# Required-Start: $local_fs $network $named $time $syslog $postgresql
|
||||
# Required-Stop: $local_fs $network $named $time $syslog $postgresql
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Script to run asp.net 5 application in background
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Ivan Derevianko aka druss <drussilla7@gmail.com>
|
||||
# Modified by: Paul Schneider <redienhcs.luap@gmail.com>
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
CONFIGS="/etc/kestrel/*.webenv"
|
||||
|
||||
TMP_SAVE_runlevel_VAR=$runlevel
|
||||
unset runlevel
|
||||
|
||||
running() {
|
||||
if [ -f $PIDFILE ]
|
||||
then
|
||||
PID=$(cat $PIDFILE)
|
||||
if kill -0 $PID 2>/dev/null
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
setdnxenv() {
|
||||
env=$1
|
||||
. $env
|
||||
# reset all except the name to default values
|
||||
export ASPNET_ENV=$NAME
|
||||
export WWW_USER=www-data
|
||||
YAVSCBIN=/usr/local/bin/yavscd
|
||||
PROJECT=approot/Web
|
||||
CONFIGURATION=Release
|
||||
ROOT=/srv/www/yavsc
|
||||
DESC="$NAME"
|
||||
PIDFILE=/var/run/kestrel-${NAME}.pid
|
||||
LOGDIR=/var/log
|
||||
# reset to specified values
|
||||
. $env
|
||||
}
|
||||
|
||||
status() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running;
|
||||
then
|
||||
echo "Service running $DESC ($NAME; pid: $PID)"
|
||||
else
|
||||
echo "Service stopped $DESC ($NAME)"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
# wait a little for postgresql to be available
|
||||
sleep 1
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running; then
|
||||
echo "Service already running $DESC" "$NAME"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "Starting service $NAME for user $WWW_USER"
|
||||
if ! start-stop-daemon -SbmCv -u $WWW_USER -p $PIDFILE -d $ROOT -g www-data -x $YAVSCBIN -- --project $PROJECT --configuration $CONFIGURATION $NAME > "${LOGDIR}/kestrel-${NAME}.log"
|
||||
then
|
||||
log_daemon_msg "Could not start $NAME : $?, see ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 2
|
||||
else
|
||||
log_daemon_msg "Service $DESC started ($NAME), logs: ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running
|
||||
then
|
||||
log_daemon_msg "Stopping service $NAME"
|
||||
start-stop-daemon -K -p "$PIDFILE"
|
||||
log_daemon_msg "$DESC stopped"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "$DESC Service not running"
|
||||
log_end_msg 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
|
||||
export runlevel=$TMP_SAVE_runlevel_VAR
|
||||
|
||||
|
@ -1,129 +0,0 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kestrel-pre
|
||||
# Required-Start: $local_fs $network $named $time $syslog $postgresql
|
||||
# Required-Stop: $local_fs $network $named $time $syslog $postgresql
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Script to run asp.net 5 application in background
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Ivan Derevianko aka druss <drussilla7@gmail.com>
|
||||
# Modified by: Paul Schneider <redienhcs.luap@gmail.com>
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
CONFIGS="/etc/kestrel/*.prewebenv"
|
||||
|
||||
TMP_SAVE_runlevel_VAR=$runlevel
|
||||
unset runlevel
|
||||
|
||||
running() {
|
||||
if [ -f $PIDFILE ]
|
||||
then
|
||||
PID=$(cat $PIDFILE)
|
||||
if kill -0 $PID 2>/dev/null
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
setdnxenv() {
|
||||
env=$1
|
||||
. $env
|
||||
# reset all except the name to default values
|
||||
export ASPNET_ENV=$NAME
|
||||
export WWW_USER=www-data
|
||||
YAVSCBIN=/usr/local/bin/yavscd-pre
|
||||
PROJECT=approot/Web
|
||||
CONFIGURATION=Release
|
||||
ROOT=/srv/www/yavscpre
|
||||
DESC="$NAME"
|
||||
PIDFILE=/var/run/kestrel-${NAME}.pid
|
||||
LOGDIR=/var/log
|
||||
# reset to specified values
|
||||
. $env
|
||||
}
|
||||
|
||||
status() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running;
|
||||
then
|
||||
echo "Service running $DESC ($NAME; pid: $PID)"
|
||||
else
|
||||
echo "Service stopped $DESC ($NAME)"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running; then
|
||||
echo "Service already running $DESC" "$NAME"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "Starting service $NAME for user $WWW_USER"
|
||||
if ! start-stop-daemon -SbmCv -u $WWW_USER -p $PIDFILE -d $ROOT -g www-data -x $YAVSCBIN -- --project $PROJECT --configuration $CONFIGURATION $NAME > "${LOGDIR}/kestrel-${NAME}.log"
|
||||
then
|
||||
log_daemon_msg "Could not start $NAME : $?, see ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 2
|
||||
else
|
||||
log_daemon_msg "Service $DESC started ($NAME), logs: ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running
|
||||
then
|
||||
log_daemon_msg "Stopping service $NAME"
|
||||
start-stop-daemon -K -p "$PIDFILE"
|
||||
log_daemon_msg "$DESC stopped"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "$DESC Service not running"
|
||||
log_end_msg 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
|
||||
export runlevel=$TMP_SAVE_runlevel_VAR
|
||||
|
||||
|
111
contrib/yavsc
Normal file
111
contrib/yavsc
Normal file
@ -0,0 +1,111 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: yavsc
|
||||
# Required-Start: $local_fs $network $named $time $syslog $postgresql
|
||||
# Required-Stop: $local_fs $network $named $time $syslog $postgresql
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Script to run yavsc
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Ivan Derevianko aka druss <drussilla7@gmail.com>
|
||||
# Modified by: Paul Schneider <redienhcs.luap@gmail.com>
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
NAME=yavsc
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
TMP_SAVE_runlevel_VAR=$runlevel
|
||||
unset runlevel
|
||||
|
||||
running() {
|
||||
if [ -f $PIDFILE ]
|
||||
then
|
||||
PID=$(cat $PIDFILE)
|
||||
if kill -0 $PID 2>/dev/null
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
export WWW_USER=www-data
|
||||
export ROOT=/srv/www/${NAME}
|
||||
export DESC="$NAME"
|
||||
export PIDFILE=/var/run/kestrel-${NAME}.pid
|
||||
export LOGDIR=/var/log
|
||||
export DOTNET_CLI_HOME=$ROOT
|
||||
export ASPDOTNETCORE_ENVIRONMENT=Production
|
||||
export ASPDOTNETCORE_LOGLEVEL=Information
|
||||
status() {
|
||||
if running;
|
||||
then
|
||||
echo "Service running $DESC ($NAME; pid: $PID)"
|
||||
else
|
||||
echo "Service stopped $DESC ($NAME)"
|
||||
fi
|
||||
echo WWW_USER: $WWW_USER ROOT:$ROOT DESC: $DESC NAME: $NAME PIDFILE: $PIDFILE LOGDIR=$LOGDIR
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
if running; then
|
||||
echo "Service already running $DESC" "$NAME"
|
||||
log_end_msg 0
|
||||
else
|
||||
cd $ROOT
|
||||
sleep 4
|
||||
log_daemon_msg "Starting service $NAME for user $WWW_USER"
|
||||
if ! start-stop-daemon -SbmCv -u $WWW_USER -p $PIDFILE -d $ROOT -g www-data -x yavsc > "${LOGDIR}/kestrel-${NAME}.log"
|
||||
then
|
||||
log_daemon_msg "Could not start $NAME : $?, see ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 2
|
||||
else
|
||||
log_daemon_msg "Service $DESC started ($NAME), logs: ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 0
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
if running
|
||||
then
|
||||
log_daemon_msg "Stopping service $NAME"
|
||||
start-stop-daemon -K -p "$PIDFILE"
|
||||
log_daemon_msg "$DESC stopped"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "$DESC Service not running"
|
||||
log_end_msg 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
|
||||
export runlevel=$TMP_SAVE_runlevel_VAR
|
||||
|
||||
|
27
contrib/yavsc.service
Normal file
27
contrib/yavsc.service
Normal file
@ -0,0 +1,27 @@
|
||||
[Unit]
|
||||
Description=Yavsc
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
Wants=postgresql.service
|
||||
After=postgresql.service
|
||||
|
||||
[Service]
|
||||
RestartSec=5s
|
||||
Type=simple
|
||||
User=www-data
|
||||
Group=www-data
|
||||
WorkingDirectory=/srv/www/yavsc/
|
||||
ExecStart=/srv/www/yavsc/Yavsc
|
||||
Restart=always
|
||||
Environment="HOME=/srv/www/yavsc"
|
||||
Environment="ASPNETCORE_ENVIRONMENT=Production"
|
||||
Environment="ASPNETCORE_ConnectionStrings__DefaultConnection=YOUR Postgresql CONNECTION STRING"
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=yavsc
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,30 +0,0 @@
|
||||
|
||||
set -e
|
||||
|
||||
# config
|
||||
export DNX_USER_HOME="`pwd -P`/dnx"
|
||||
|
||||
# rt
|
||||
mkdir -p dnx/runtimes
|
||||
cd dnx/runtimes
|
||||
curl --insecure -sSL https://freespeech.pschneider.fr/files/Paul/dnx-mono.1.0.0-rc1-update2.tar.bz2 |tar xj
|
||||
cd ..
|
||||
|
||||
# dnvm
|
||||
mkdir -p dnvm
|
||||
cd dnvm
|
||||
curl --insecure -sSL https://freespeech.pschneider.fr/files/Paul/dnvm.sh >dnvm.sh
|
||||
cd ..
|
||||
|
||||
# alias
|
||||
mkdir -p alias
|
||||
echo "dnx-mono.1.0.0-rc1-update2" >alias/default.alias
|
||||
. dnvm/dnvm.sh
|
||||
|
||||
# end
|
||||
cd ..
|
||||
|
||||
echo "DNX a été ressucité dans $DNX_USER_HOME"
|
||||
echo "Pour utiliser dnx et dnu:"
|
||||
echo " . ${DNX_USER_HOME}/dnvm/dnvm.sh"
|
||||
|
13
global.json
13
global.json
@ -1,13 +0,0 @@
|
||||
{
|
||||
"projects": [
|
||||
"src",
|
||||
"scripts",
|
||||
"tests"
|
||||
],
|
||||
"sdk": {
|
||||
"version": "1.0.0-rc1-update2",
|
||||
"runtime": "mono",
|
||||
"architecture": "x64"
|
||||
},
|
||||
"packages": "packages"
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
"dotnet": {
|
||||
"enabled": false
|
||||
},
|
||||
"msbuild": {
|
||||
"enabled": false
|
||||
},
|
||||
"Dnx": {
|
||||
"enabled": true,
|
||||
"enablePackageRestore": false,
|
||||
"projects": "src/*/project.json;*/project.json;project.json;test/*/project.json"
|
||||
},
|
||||
"Script": {
|
||||
"enabled": false
|
||||
},
|
||||
"fileOptions": {
|
||||
"systemExcludeSearchPatterns": [
|
||||
"**/bin/**/*",
|
||||
"**/obj/**/*",
|
||||
"**/node_modules/**/*"
|
||||
],
|
||||
"userExcludeSearchPatterns": []
|
||||
}
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
include versioning.mk
|
||||
|
||||
|
||||
REPO_ROOT=../../../src
|
||||
|
||||
SUBDIRS=Yavsc Yavsc.Server Yavsc.Abstract OAuth.AspNet.AuthServer OAuth.AspNet.Token cli test
|
||||
|
||||
all: $(SUBDIRS)
|
||||
|
||||
Yavsc.Abstract:
|
||||
$(MAKE) -C $(REPO_ROOT)/Yavsc.Abstract VERSION=$(VERSION)
|
||||
|
||||
OAuth.AspNet.Token:
|
||||
$(MAKE) -C $(REPO_ROOT)/OAuth.AspNet.Token VERSION=$(VERSION)
|
||||
|
||||
OAuth.AspNet.AuthServer: OAuth.AspNet.Token
|
||||
$(MAKE) -C $(REPO_ROOT)/OAuth.AspNet.AuthServer VERSION=$(VERSION)
|
||||
|
||||
Yavsc.Server: Yavsc.Abstract
|
||||
$(MAKE) -C $(REPO_ROOT)/Yavsc.Server VERSION=$(VERSION)
|
||||
|
||||
Yavsc: Yavsc.Server OAuth.AspNet.AuthServer OAuth.AspNet.Token
|
||||
make -C $(REPO_ROOT)/Yavsc VERSION=$(VERSION)
|
||||
|
||||
Yavsc-deploy-pkg: Yavsc
|
||||
make -C $(REPO_ROOT)/Yavsc deploy-pkg
|
||||
|
||||
Yavsc.Server-deploy-pkg: Yavsc.Server
|
||||
make -C $(REPO_ROOT)/Yavsc.Server deploy-pkg
|
||||
|
||||
Yavsc.Abstract-deploy-pkg: Yavsc.Abstract
|
||||
make -C $(REPO_ROOT)/Yavsc.Abstract deploy-pkg
|
||||
|
||||
cli-deploy-pkg: cli check
|
||||
make -C $(REPO_ROOT)/cli deploy-pkg
|
||||
|
||||
cli: Yavsc-deploy-pkg Yavsc.Server-deploy-pkg Yavsc.Abstract-deploy-pkg
|
||||
make -C $(REPO_ROOT)/cli
|
||||
|
||||
undoLocalYavscNugetDeploy:
|
||||
rm -rf ../../../packages/Yavsc.Abstract
|
||||
rm -rf ../../../packages/Yavsc.Server
|
||||
rm -rf ../../../packages/Yavsc
|
||||
rm -rf ~/.dnx/packages/Yavsc.Abstract
|
||||
rm -rf ~/.dnx/packages/Yavsc.Server
|
||||
rm -rf ~/.dnx/packages/Yavsc
|
||||
|
||||
check: cli
|
||||
make -C $(REPO_ROOT)/cli check
|
||||
make -C $(REPO_ROOT)/test
|
||||
|
||||
test:
|
||||
make -C $(REPO_ROOT)/test
|
||||
|
||||
pushInPre:
|
||||
make -C $(REPO_ROOT)/Yavsc pushInPre
|
||||
|
||||
pushInProd:
|
||||
make -C $(REPO_ROOT)/Yavsc pushInProd
|
||||
|
||||
deploy-pkgs: Yavsc-deploy-pkg Yavsc.Server-deploy-pkg Yavsc.Abstract-deploy-pkg cli-deploy-pkg
|
||||
|
||||
memo:
|
||||
vim ~/TODO.md
|
||||
|
||||
rc-num:
|
||||
@echo echo 1-alpha1 < $< ^ $^ @ $@
|
||||
|
||||
clean:
|
||||
for subdir in $(SUBDIRS) ; do \
|
||||
make -C $(REPO_ROOT)/$${subdir} clean ; \
|
||||
done
|
||||
|
||||
watch:
|
||||
make -C $(REPO_ROOT)/Yavsc watch
|
||||
|
||||
.PHONY: all $(SUBDIRS)
|
||||
|
@ -1,76 +0,0 @@
|
||||
# Common defs
|
||||
#
|
||||
|
||||
ifndef PRJNAME
|
||||
PRJNAME := $(shell basename `pwd -P`)
|
||||
endif
|
||||
FRAMEWORK=dnx451
|
||||
ASPNET_ENV=Development
|
||||
ASPNET_LOG_LEVEL=Debug
|
||||
HOSTING=localhost
|
||||
HOSTADMIN=root
|
||||
FRAMEWORKALIAS=dnx451
|
||||
# nuget package destination, at generation time
|
||||
BINTARGET=$(PRJNAME).dll
|
||||
BINTARGETPATH=bin/$(CONFIGURATION)/$(FRAMEWORKALIAS)/$(BINTARGET)
|
||||
PKGFILENAME=$(PRJNAME).$(VERSION).nupkg
|
||||
dnu=dnu
|
||||
dnx=ndnx
|
||||
|
||||
# OBS SUBDIRS=Yavsc.Server Yavsc.Abstract Yavsc cli
|
||||
#
|
||||
|
||||
# Git commit hash, in order to not publish some uncrontrolled code in production environment
|
||||
#
|
||||
|
||||
git_status := $(shell git status -s --porcelain |wc -l)
|
||||
|
||||
all: $(BINTARGETPATH)
|
||||
|
||||
|
||||
restore:
|
||||
touch project.json
|
||||
$(dnu) restore --ignore-failed-sources
|
||||
|
||||
project.lock.json: project.json
|
||||
$(dnu) restore --ignore-failed-sources
|
||||
|
||||
watch: project.lock.json
|
||||
MONO_OPTIONS=--debug MONO_MANAGED_WATCHER=enabled ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) dnx-watch web --configuration=$(CONFIGURATION)
|
||||
|
||||
clean:
|
||||
rm -rf bin obj
|
||||
rm project.lock.json
|
||||
|
||||
cleanoutput:
|
||||
rm -rf bin/$(CONFIGURATION)
|
||||
rm -rf bin/output
|
||||
|
||||
$(BINTARGETPATH): project.lock.json rc-num.txt-check
|
||||
$(dnu) build --configuration=$(CONFIGURATION)
|
||||
|
||||
# Default target, from one level sub dirs
|
||||
|
||||
bin/output:
|
||||
@$(dnu) publish
|
||||
|
||||
bin/output/wwwroot/version: bin/output
|
||||
echo $(version) > bin/output/wwwroot/version
|
||||
|
||||
# @git log -1 --pretty=format:%h > bin/output/wwwroot/version
|
||||
|
||||
pack: $(NUGETSOURCE)/$(PKGFILENAME)
|
||||
|
||||
$(NUGETSOURCE)/$(PKGFILENAME): $(BINTARGETPATH) ../../version.txt
|
||||
ifeq ($(git_status),0)
|
||||
nuget pack $(PRJNAME).nuspec -Version $(VERSION) -Properties config=$(CONFIGURATION) -OutputDirectory bin
|
||||
else
|
||||
$(error Please, commit your changes before publishing your NuGet packages)
|
||||
endif
|
||||
|
||||
deploy-pkg: pack
|
||||
@mv bin/$(PKGFILENAME) $(NUGETSOURCE)
|
||||
|
||||
.PHONY: rc-num.txt-check
|
||||
|
||||
# .DEFAULT_GOAL := $(BINTARGETPATH)
|
@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
MSBUILD=msbuild
|
||||
MONO=mono
|
||||
CONFIGURATION=Debug
|
||||
BINTYPE=exe
|
||||
PRJNAME := $(shell basename `pwd -P`)
|
||||
SOLUTIONDIR=$(HOME)/workspace/yavsc
|
||||
rc_num := $(shell cat $(SOLUTIONDIR)/rc-num.txt)
|
||||
VERSION=1.0.5-rc$(rc_num)
|
||||
|
||||
BINTARGET=$(PRJNAME).$(BINTYPE)
|
||||
BINTARGETPATH=bin/$(CONFIGURATION)/$(BINTARGET)
|
||||
NUGETSOURCE=$(HOME)/Nupkgs
|
||||
PKGFILENAME=$(PRJNAME).$(VERSION).nupkg
|
||||
|
@ -1,19 +0,0 @@
|
||||
|
||||
ifndef PRJNAME
|
||||
PRJNAME := $(shell basename `pwd -P`)
|
||||
endif
|
||||
SOLUTIONDIR=../..
|
||||
version := $(shell cat $(SOLUTIONDIR)/version.txt)
|
||||
MAKE=make
|
||||
NUGETSOURCE=$(HOME)/Nupkgs
|
||||
VERSION=$(version)
|
||||
CONFIGURATION=Debug
|
||||
|
||||
version-check:
|
||||
ifndef version
|
||||
@echo no version number specification ... please, could you try and run 'echo 1.2.3 > $(SOLUTIONDIR)version.txt' ?.
|
||||
else
|
||||
@echo 'Got version number : $(version)'
|
||||
endif
|
||||
|
||||
|
@ -1,145 +0,0 @@
|
||||
@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase
|
||||
@using Microsoft.Extensions.CodeGeneration.EntityFramework
|
||||
@@model @Model.ViewDataTypeName
|
||||
|
||||
@{
|
||||
if (Model.IsPartialView)
|
||||
{
|
||||
}
|
||||
else if (Model.IsLayoutPageSelected)
|
||||
{
|
||||
@:@@{
|
||||
@:ViewData["Title"] = @@SR["@Model.ViewName"];
|
||||
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
|
||||
{
|
||||
@:Layout = "@Model.LayoutPageFile";
|
||||
}
|
||||
@:}
|
||||
@:
|
||||
@:<h2>@@SR["@Model.ViewName"]</h2>
|
||||
@:
|
||||
}
|
||||
else
|
||||
{
|
||||
@:@@{
|
||||
@:Layout = null;
|
||||
@:}
|
||||
@:
|
||||
@:<!DOCTYPE html>
|
||||
@:
|
||||
@:<html>
|
||||
@:<head>
|
||||
@:<meta name="viewport" content="width=device-width" />
|
||||
@:<title>@Model.ViewName</title>
|
||||
@:</head>
|
||||
@:<body>
|
||||
@:
|
||||
// PushIndent(" ");
|
||||
}
|
||||
@:<form asp-action="@Model.ViewName">
|
||||
@:<div class="form-horizontal">
|
||||
@:<h4>@@SR["@Model.ViewDataTypeShortName"]</h4>
|
||||
@:<hr />
|
||||
@:<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||
foreach (var property in Model.ModelMetadata.Properties)
|
||||
{
|
||||
if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly)
|
||||
{
|
||||
|
||||
// If the property is a primary key and Guid, then the Guid is generated in the controller. Hence, this propery is not displayed on the view.
|
||||
if (property.IsPrimaryKey)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.IsForeignKey)
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
|
||||
@:<div class="col-md-10">
|
||||
@:<select asp-for="@property.PropertyName" class ="form-control"></select>
|
||||
@:</div>
|
||||
@:</div>
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isCheckbox = property.TypeName.Equals("System.Boolean");
|
||||
if (isCheckbox)
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<div class="col-md-offset-2 col-md-10">
|
||||
@:<div class="checkbox">
|
||||
@:<input asp-for="@property.PropertyName" />
|
||||
@:<label asp-for="@property.PropertyName"></label>
|
||||
@:</div>
|
||||
@:</div>
|
||||
@:</div>
|
||||
}
|
||||
else if (property.IsEnum && !property.IsEnumFlags)
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
|
||||
@:<div class="col-md-10">
|
||||
@:<select asp-for="@property.PropertyName" class="form-control"></select>
|
||||
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
|
||||
@:</div>
|
||||
@:</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
|
||||
@:<div class="col-md-10">
|
||||
@:<input asp-for="@property.PropertyName" class="form-control" />
|
||||
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
|
||||
@:</div>
|
||||
@:</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">@@SR["Back to List"]</a>
|
||||
</div>
|
||||
|
||||
@{
|
||||
if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView))
|
||||
{
|
||||
@:@@section Scripts {
|
||||
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
@:}
|
||||
}
|
||||
// The following code closes the tag used in the case of a view using a layout page and the body and html tags in the case of a regular view page
|
||||
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
|
||||
{
|
||||
if (Model.ReferenceScriptLibraries)
|
||||
{
|
||||
@:@@section Scripts {
|
||||
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
@:}
|
||||
//ClearIndent();
|
||||
}
|
||||
@:</body>
|
||||
@:</html>
|
||||
}
|
||||
}
|
||||
@functions
|
||||
{
|
||||
// Do we need to use this in conjunction with the PrimaryKey check?
|
||||
bool IsPropertyGuid(PropertyMetadata property)
|
||||
{
|
||||
return string.Equals("System.Guid", property.TypeName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase
|
||||
@using Microsoft.Extensions.CodeGeneration.EntityFramework
|
||||
@@model @Model.ViewDataTypeName
|
||||
|
||||
@{
|
||||
if (Model.IsPartialView)
|
||||
{
|
||||
}
|
||||
else if (Model.IsLayoutPageSelected)
|
||||
{
|
||||
@:@@{
|
||||
@:ViewData["Title"] = @@SR["@Model.ViewName"];
|
||||
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
|
||||
{
|
||||
@:Layout = "@Model.LayoutPageFile";
|
||||
}
|
||||
@:}
|
||||
@:
|
||||
@:<h2>@@SR["@Model.ViewName"]</h2>
|
||||
@:
|
||||
}
|
||||
else
|
||||
{
|
||||
@:@@{
|
||||
@:Layout = null;
|
||||
@:}
|
||||
@:
|
||||
@:<!DOCTYPE html>
|
||||
@:
|
||||
@:<html>
|
||||
@:<head>
|
||||
@:<meta name="viewport" content="width=device-width" />
|
||||
@:<title>@@SR[@Model.ViewName]</title>
|
||||
@:</head>
|
||||
@:<body>
|
||||
@:
|
||||
// PushIndent(" ");
|
||||
}
|
||||
}
|
||||
<h3>@@SR["AreYourSureYouWantToDeleteThis"]</h3>
|
||||
<div>
|
||||
<h4>@@SR[@Model.ViewDataTypeShortName]</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
@{
|
||||
foreach (var property in Model.ModelMetadata.Properties)
|
||||
{
|
||||
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
|
||||
{
|
||||
<dt>
|
||||
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
|
||||
</dt>
|
||||
<dd>
|
||||
@@Html.DisplayFor(model => model.@GetValueExpression(property))
|
||||
</dd>
|
||||
}
|
||||
}
|
||||
@:</dl>
|
||||
@:
|
||||
@:<form asp-action="@Model.ViewName">
|
||||
@:<div class="form-actions no-color">
|
||||
@:<input type="submit" value="@@SR["Delete"]" class="btn btn-default" /> |
|
||||
@:<a asp-action="Index">@@SR["Back to List"]</a>
|
||||
@:</div>
|
||||
@:</form>
|
||||
@:</div>
|
||||
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
|
||||
{
|
||||
//ClearIndent();
|
||||
@:</body>
|
||||
@:</html>
|
||||
}
|
||||
}
|
||||
@functions
|
||||
{
|
||||
string GetValueExpression(PropertyMetadata property)
|
||||
{
|
||||
//Todo: Get the association for the property and use that.
|
||||
return property.PropertyName;
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase
|
||||
@using Microsoft.Extensions.CodeGeneration.EntityFramework
|
||||
@@model @Model.ViewDataTypeName
|
||||
|
||||
@{
|
||||
if (Model.IsPartialView)
|
||||
{
|
||||
}
|
||||
else if (Model.IsLayoutPageSelected)
|
||||
{
|
||||
@:@@{
|
||||
@:ViewData["Title"] = @@SR["@Model.ViewName"];
|
||||
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
|
||||
{
|
||||
@:Layout = "@Model.LayoutPageFile";
|
||||
}
|
||||
@:}
|
||||
@:
|
||||
@:<h2>@@SR["@Model.ViewName"]</h2>
|
||||
@:
|
||||
}
|
||||
else
|
||||
{
|
||||
@:@@{
|
||||
@:Layout = null;
|
||||
@:}
|
||||
@:
|
||||
@:<!DOCTYPE html>
|
||||
@:
|
||||
@:<html>
|
||||
@:<head>
|
||||
@:<meta name="viewport" content="width=device-width" />
|
||||
@:<title>@Model.ViewName</title>
|
||||
@:</head>
|
||||
@:<body>
|
||||
@:
|
||||
// PushIndent(" ");
|
||||
}
|
||||
}
|
||||
<div>
|
||||
<h4>@Model.ViewDataTypeShortName</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
@{
|
||||
foreach (var property in Model.ModelMetadata.Properties)
|
||||
{
|
||||
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
|
||||
{
|
||||
<dt>
|
||||
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
|
||||
</dt>
|
||||
<dd>
|
||||
@@Html.DisplayFor(model => model.@GetValueExpression(property))
|
||||
</dd>
|
||||
}
|
||||
}
|
||||
} </dl>
|
||||
</div>
|
||||
<p>
|
||||
@{
|
||||
string pkName = GetPrimaryKeyName();
|
||||
if (pkName != null)
|
||||
{
|
||||
@:<a asp-action="Edit" asp-route-id="@@Model.@pkName">@@SR["Edit"]</a> |
|
||||
@:<a asp-action="Index">@@SR["Back to List"]</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
@:@@Html.ActionLink(@@SR["Edit"], "Edit", new { /* id = Model.PrimaryKey */ }) |
|
||||
@:<a asp-action="Index">@@SR["Back to List"]</a>
|
||||
}
|
||||
}</p>
|
||||
@{
|
||||
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
|
||||
{
|
||||
//ClearIndent();
|
||||
@:</body>
|
||||
@:</html>
|
||||
}
|
||||
}
|
||||
@functions
|
||||
{
|
||||
string GetPrimaryKeyName()
|
||||
{
|
||||
return (Model.ModelMetadata.PrimaryKeys != null && Model.ModelMetadata.PrimaryKeys.Length == 1)
|
||||
? Model.ModelMetadata.PrimaryKeys[0].PropertyName
|
||||
: null;
|
||||
}
|
||||
|
||||
string GetValueExpression(PropertyMetadata property)
|
||||
{
|
||||
//Todo: Get the association for the property and use that.
|
||||
return property.PropertyName;
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase
|
||||
@using Microsoft.Extensions.CodeGeneration.EntityFramework
|
||||
@@model @Model.ViewDataTypeName
|
||||
|
||||
@{
|
||||
if (Model.IsPartialView)
|
||||
{
|
||||
}
|
||||
else if (Model.IsLayoutPageSelected)
|
||||
{
|
||||
@:@@{
|
||||
@:ViewData["Title"] = @@SR["@Model.ViewName"];
|
||||
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
|
||||
{
|
||||
@:Layout = "@Model.LayoutPageFile";
|
||||
}
|
||||
@:}
|
||||
@:
|
||||
@:<h2>@@SR["@Model.ViewName"]</h2>
|
||||
@:
|
||||
}
|
||||
else
|
||||
{
|
||||
@:@@{
|
||||
@:Layout = null;
|
||||
@:}
|
||||
@:
|
||||
@:<!DOCTYPE html>
|
||||
@:
|
||||
@:<html>
|
||||
@:<head>
|
||||
@:<meta name="viewport" content="width=device-width" />
|
||||
@:<title>@@SR["@Model.ViewName"]</title>
|
||||
@:</head>
|
||||
@:<body>
|
||||
@:
|
||||
// PushIndent(" ");
|
||||
}
|
||||
@:<form asp-action="@Model.ViewName">
|
||||
@:<div class="form-horizontal">
|
||||
@:<h4>@Model.ViewDataTypeShortName</h4>
|
||||
@:<hr />
|
||||
@:<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||
foreach (PropertyMetadata property in Model.ModelMetadata.Properties)
|
||||
{
|
||||
if (property.Scaffold)
|
||||
{
|
||||
if (property.IsPrimaryKey)
|
||||
{
|
||||
@:<input type="hidden" asp-for="@property.PropertyName" />
|
||||
continue;
|
||||
}
|
||||
if (property.IsReadOnly)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.IsForeignKey)
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<label asp-for="@property.PropertyName" class="control-label col-md-2">@GetAssociationName(property)</label>
|
||||
@:<div class="col-md-10">
|
||||
@:<select asp-for="@property.PropertyName" class="form-control" ></select>
|
||||
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
|
||||
@:</div>
|
||||
@:</div>
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isCheckbox = property.TypeName.Equals("System.Boolean");
|
||||
if (isCheckbox)
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<div class="col-md-offset-2 col-md-10">
|
||||
@:<div class="checkbox">
|
||||
@:<input asp-for="@property.PropertyName" />
|
||||
@:<label asp-for="@property.PropertyName"></label>
|
||||
@:</div>
|
||||
@:</div>
|
||||
@:</div>
|
||||
}
|
||||
else if (property.IsEnum && !property.IsEnumFlags)
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
|
||||
@:<div class="col-md-10">
|
||||
@:<select asp-for="@property.PropertyName" class="form-control"></select>
|
||||
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
|
||||
@:</div>
|
||||
@:</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@:<div class="form-group">
|
||||
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
|
||||
@:<div class="col-md-10">
|
||||
@:<input asp-for="@property.PropertyName" class="form-control" />
|
||||
@:<span asp-validation-for="@property.PropertyName" class="text-danger"></span>
|
||||
@:</div>
|
||||
@:</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">@@SR["Back to List"]</a>
|
||||
</div>
|
||||
|
||||
@{
|
||||
if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView))
|
||||
{
|
||||
@:@@section Scripts {
|
||||
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
@:}
|
||||
}
|
||||
// The following code closes the tag used in the case of a view using a layout page and the body and html tags in the case of a regular view page
|
||||
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
|
||||
{
|
||||
if (Model.ReferenceScriptLibraries)
|
||||
{
|
||||
@:@@section Scripts {
|
||||
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
@:}
|
||||
//ClearIndent();
|
||||
}
|
||||
@:</body>
|
||||
@:</html>
|
||||
}
|
||||
}
|
||||
@functions
|
||||
{
|
||||
string GetAssociationName(PropertyMetadata property)
|
||||
{
|
||||
//Todo: Implement properly.
|
||||
return property.PropertyName;
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase
|
||||
@using Microsoft.Extensions.CodeGeneration.EntityFramework
|
||||
@@model @GetEnumerableTypeExpression(Model.ViewDataTypeName)
|
||||
|
||||
@{
|
||||
if (Model.IsPartialView)
|
||||
{
|
||||
}
|
||||
else if (Model.IsLayoutPageSelected)
|
||||
{
|
||||
@:@@{
|
||||
@:ViewData["Title"] = @@SR["@Model.ViewName"];
|
||||
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
|
||||
{
|
||||
@:Layout = "@Model.LayoutPageFile";
|
||||
}
|
||||
@:}
|
||||
@:
|
||||
@:<h2>@@SR["@Model.ViewName"]</h2>
|
||||
@:
|
||||
}
|
||||
else
|
||||
{
|
||||
@:@@{
|
||||
@:Layout = null;
|
||||
@:}
|
||||
@:
|
||||
@:<!DOCTYPE html>
|
||||
@:
|
||||
@:<html>
|
||||
@:<head>
|
||||
@:<meta name="viewport" content="width=device-width" />
|
||||
@:<title>@@SR["@Model.ViewName"]</title>
|
||||
@:</head>
|
||||
@:<body>
|
||||
// PushIndent(" ");
|
||||
}
|
||||
@:<p>
|
||||
@:<a asp-action="Create">@@SR["Create New"]</a>
|
||||
@:</p>
|
||||
@:<table class="table">
|
||||
@:<tr>
|
||||
IEnumerable<PropertyMetadata> properties = Model.ModelMetadata.Properties;
|
||||
foreach (var property in properties)
|
||||
{
|
||||
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
|
||||
{
|
||||
<th>
|
||||
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
|
||||
</th>
|
||||
}
|
||||
}
|
||||
@:<th></th>
|
||||
@:</tr>
|
||||
@:
|
||||
@:@@foreach (var item in Model) {
|
||||
@:<tr>
|
||||
foreach (PropertyMetadata property in properties)
|
||||
{
|
||||
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
|
||||
{
|
||||
<td>
|
||||
@@Html.DisplayFor(modelItem => item.@GetValueExpression(property))
|
||||
</td>
|
||||
}
|
||||
}
|
||||
|
||||
string pkName = GetPrimaryKeyName();
|
||||
if (pkName != null)
|
||||
{
|
||||
@:<td>
|
||||
@:<a asp-action="Edit" asp-route-id="@@item.@pkName">@@SR["Edit"]</a> |
|
||||
@:<a asp-action="Details" asp-route-id="@@item.@pkName">@@SR["Details"]</a> |
|
||||
@:<a asp-action="Delete" asp-route-id="@@item.@pkName">@@SR["Delete"]</a>
|
||||
@:</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>
|
||||
@@Html.ActionLink(SR["Edit"], "Edit",new { /* id=item.PrimaryKey */ }) |
|
||||
@@Html.ActionLink(SR["Details"], "Details", new { /* id=item.PrimaryKey */ }) |
|
||||
@@Html.ActionLink(SR["Delete"], "Delete", new { /* id=item.PrimaryKey */ })
|
||||
</td>
|
||||
}
|
||||
@:</tr>
|
||||
@:}
|
||||
|
||||
@:</table>
|
||||
if(!Model.IsPartialView && !Model.IsLayoutPageSelected)
|
||||
{
|
||||
//ClearIndent();
|
||||
@:</body>
|
||||
@:</html>
|
||||
}
|
||||
}
|
||||
@functions
|
||||
{
|
||||
string GetPrimaryKeyName()
|
||||
{
|
||||
return (Model.ModelMetadata.PrimaryKeys != null && Model.ModelMetadata.PrimaryKeys.Length == 1)
|
||||
? Model.ModelMetadata.PrimaryKeys[0].PropertyName
|
||||
: null;
|
||||
}
|
||||
|
||||
string GetValueExpression(PropertyMetadata property)
|
||||
{
|
||||
//Todo: Get the association for the property and use that.
|
||||
return property.PropertyName;
|
||||
}
|
||||
|
||||
string GetEnumerableTypeExpression(string typeName)
|
||||
{
|
||||
return "IEnumerable<" + typeName + ">";
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
version="$1"
|
||||
major=0
|
||||
minor=0
|
||||
build=0
|
||||
|
||||
# break down the version number into it's components
|
||||
regex="([0-9]+).([0-9]+).([0-9]+)((-[A-Za-z]+)([0-9]+))?"
|
||||
if [[ $version =~ $regex ]]; then
|
||||
major="${BASH_REMATCH[1]}"
|
||||
minor="${BASH_REMATCH[2]}"
|
||||
build="${BASH_REMATCH[3]}"
|
||||
patchtype="${BASH_REMATCH[5]}"
|
||||
patchnum="${BASH_REMATCH[6]}"
|
||||
fi
|
||||
|
||||
# check paramater to see which number to increment
|
||||
if [[ "$2" == "feature" ]]; then
|
||||
minor=$(echo $minor + 1 | bc)
|
||||
build=0
|
||||
patchtype=
|
||||
patchnum=
|
||||
elif [[ "$2" == "build" ]]; then
|
||||
build=$(echo $build + 1 | bc)
|
||||
patchtype=
|
||||
patchnum=
|
||||
elif [[ "$2" == "major" ]]; then
|
||||
major=$(echo $major+1 | bc)
|
||||
minor=0
|
||||
build=0
|
||||
patchtype=
|
||||
patchnum=
|
||||
elif [[ "$2" == "patch" ]]; then
|
||||
patchnum=$(echo $patchnum + 1 | bc)
|
||||
else
|
||||
echo "usage: ./version.sh version_number [major/feature/build/patch]" >&2
|
||||
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# echo the new version number
|
||||
echo "${major}.${minor}.${build}${patchtype}${patchnum}"
|
||||
|
12
src/Api/Api.csproj
Normal file
12
src/Api/Api.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>1c73094f-959f-4211-b1a1-6a69b236c283</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
||||
<ProjectReference Include="../Yavsc.Server/Yavsc.Server.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
153
src/Api/Controllers/Blogspot/BlogApiController.cs
Normal file
153
src/Api/Controllers/Blogspot/BlogApiController.cs
Normal file
@ -0,0 +1,153 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/blog")]
|
||||
|
||||
public class BlogApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public BlogApiController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/BlogApi
|
||||
[HttpGet]
|
||||
public IEnumerable<BlogPost> GetBlogspot(int start=0, int take=25)
|
||||
{
|
||||
return _context.BlogSpot.OrderByDescending(b => b.UserModified)
|
||||
.Skip(start).Take(take);
|
||||
}
|
||||
|
||||
// GET: api/BlogApi/5
|
||||
[HttpGet("{id}", Name = "GetBlog")]
|
||||
public IActionResult GetBlog([FromRoute] long id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogPost blog = _context.BlogSpot.Single(m => m.Id == id);
|
||||
|
||||
if (blog == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(blog);
|
||||
}
|
||||
|
||||
// PUT: api/BlogApi/5
|
||||
[HttpPut("{id}")]
|
||||
public IActionResult PutBlog(long id, [FromBody] BlogPost blog)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != blog.Id)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(blog).State = EntityState.Modified;
|
||||
|
||||
try
|
||||
{
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!BlogExists(id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BlogApi
|
||||
[HttpPost]
|
||||
public IActionResult PostBlog([FromBody] Models.Blog.BlogPost blog)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.BlogSpot.Add(blog);
|
||||
try
|
||||
{
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
}
|
||||
catch (DbUpdateException)
|
||||
{
|
||||
if (BlogExists(blog.Id))
|
||||
{
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return CreatedAtRoute("GetBlog", new { id = blog.Id }, blog);
|
||||
}
|
||||
|
||||
// DELETE: api/BlogApi/5
|
||||
[HttpDelete("{id}")]
|
||||
public IActionResult DeleteBlog(long id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogPost blog = _context.BlogSpot.Single(m => m.Id == id);
|
||||
if (blog == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.BlogSpot.Remove(blog);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
return Ok(blog);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_context.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private bool BlogExists(long id)
|
||||
{
|
||||
return _context.BlogSpot.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
namespace Yavsc.Controllers
|
||||
@ -32,14 +32,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag blogTag = await _context.TagsDomain.SingleAsync(m => m.PostId == id);
|
||||
|
||||
if (blogTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(blogTag);
|
||||
@ -51,12 +51,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != blogTag.PostId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(blogTag).State = EntityState.Modified;
|
||||
@ -69,7 +69,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!BlogTagExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -77,7 +77,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BlogTagsApi
|
||||
@ -86,7 +86,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.TagsDomain.Add(blogTag);
|
||||
@ -98,7 +98,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (BlogTagExists(blogTag.PostId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -115,13 +115,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag blogTag = await _context.TagsDomain.SingleAsync(m => m.PostId == id);
|
||||
if (blogTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.TagsDomain.Remove(blogTag);
|
136
src/Api/Controllers/Blogspot/CommentsApiController.cs
Normal file
136
src/Api/Controllers/Blogspot/CommentsApiController.cs
Normal file
@ -0,0 +1,136 @@
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Produces("application/json")]
|
||||
[Route("api/blogcomments")]
|
||||
public class CommentsApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CommentsApiController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "GetComment")]
|
||||
public async Task<IActionResult> GetComment([FromRoute] long id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Comment comment = await _context.Comment.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(comment);
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Post([FromBody] CommentPost post)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return new BadRequestObjectResult(ModelState);
|
||||
}
|
||||
var article = await _context.BlogSpot.FirstOrDefaultAsync
|
||||
(p=> p.Id == post.ReceiverId);
|
||||
|
||||
if (article==null) {
|
||||
ModelState.AddModelError("ReceiverId", "not found");
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
if (post.ParentId!=null)
|
||||
{
|
||||
var parentExists = _context.Comment.Any(c => c.Id == post.ParentId);
|
||||
if (!parentExists)
|
||||
{
|
||||
ModelState.AddModelError("ParentId", "not found");
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
string uid = User.GetUserId();
|
||||
Comment c = new Comment{
|
||||
ReceiverId = post.ReceiverId,
|
||||
Content = post.Content,
|
||||
ParentId = post.ParentId,
|
||||
AuthorId = uid,
|
||||
UserModified = uid
|
||||
};
|
||||
|
||||
_context.Comment.Add(c);
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync(uid);
|
||||
}
|
||||
catch (DbUpdateException)
|
||||
{
|
||||
if (CommentExists(c.Id))
|
||||
{
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return CreatedAtRoute("GetComment", new { id = c.Id }, new { id = c.Id, dateCreated = c.DateCreated });
|
||||
}
|
||||
|
||||
// DELETE: api/CommentsApi/5
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> Delete([FromRoute] long id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Comment comment = await _context.Comment.SingleAsync(m => m.Id == id);
|
||||
if (comment == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
RemoveRecursive(comment);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
|
||||
return Ok(comment);
|
||||
}
|
||||
private void RemoveRecursive (Comment comment)
|
||||
{
|
||||
var children = _context.Comment.Where
|
||||
(c=>c.ParentId==comment.Id).ToList();
|
||||
foreach (var child in children) {
|
||||
RemoveRecursive(child);
|
||||
}
|
||||
_context.Comment.Remove(comment);
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_context.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private bool CommentExists(long id)
|
||||
{
|
||||
return _context.Comment.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
@ -11,11 +9,13 @@ namespace Yavsc.ApiControllers
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Exceptions;
|
||||
using Yavsc.Models.FileSystem;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using System.IO;
|
||||
using Yavsc.Exceptions;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Yavsc.Abstract.Helpers;
|
||||
|
||||
[Authorize,Route("api/fs")]
|
||||
public partial class FileSystemApiController : Controller
|
||||
@ -45,7 +45,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid) return new BadRequestObjectResult(ModelState);
|
||||
// _logger.LogInformation($"listing files from {User.Identity.Name}{subdir}");
|
||||
var files = AbstractFileSystemHelpers.GetUserFiles(User.Identity.Name, subdir);
|
||||
var files = AbstractFileSystemHelpers.GetUserFiles(User.GetUserId(), subdir);
|
||||
return Ok(files);
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid) return new BadRequestObjectResult(ModelState);
|
||||
string destDir = null;
|
||||
List<FileRecievedInfo> received = new List<FileRecievedInfo>();
|
||||
List<FileReceivedInfo> received = new List<FileReceivedInfo>();
|
||||
InvalidPathException pathex = null;
|
||||
try {
|
||||
destDir = User.InitPostToFileSystem(subdir);
|
||||
@ -63,7 +63,7 @@ namespace Yavsc.ApiControllers
|
||||
}
|
||||
if (pathex!=null) {
|
||||
_logger.LogError($"invalid sub path: '{subdir}'.");
|
||||
return HttpBadRequest(pathex);
|
||||
return BadRequest(pathex);
|
||||
}
|
||||
_logger.LogInformation($"Receiving files, saved in '{destDir}' (specified as '{subdir}').");
|
||||
|
||||
@ -80,7 +80,7 @@ namespace Yavsc.ApiControllers
|
||||
dbContext.SaveChanges(User.GetUserId());
|
||||
received.Add(item);
|
||||
_logger.LogInformation($"Received '{item.FileName}'.");
|
||||
if (item.QuotaOffensed)
|
||||
if (item.QuotaOffense)
|
||||
break;
|
||||
i++;
|
||||
};
|
||||
@ -91,7 +91,7 @@ namespace Yavsc.ApiControllers
|
||||
[Authorize("AdministratorOnly")]
|
||||
public IActionResult AddQuota(string uname, int len)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.FirstOrDefault(
|
||||
u => u.UserName == uname
|
||||
);
|
||||
@ -107,13 +107,13 @@ namespace Yavsc.ApiControllers
|
||||
public IActionResult MoveFile([FromBody] RenameFileQuery query)
|
||||
{
|
||||
if (!ModelState.IsValid) return new BadRequestObjectResult(ModelState);
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.Single(
|
||||
u => u.Id == uid
|
||||
);
|
||||
var info = user.MoveUserFileToDir(query.id, query.to);
|
||||
var info = user.MoveUserFileToDir(query.Id, query.To);
|
||||
if (!info.Done) return new BadRequestObjectResult(info);
|
||||
return Ok(new { moved = query.id });
|
||||
return Ok(new { moved = query.Id });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -124,21 +124,21 @@ namespace Yavsc.ApiControllers
|
||||
if (!ModelState.IsValid) {
|
||||
var idvr = new ValidRemoteUserFilePathAttribute();
|
||||
|
||||
return this.HttpBadRequest(new { id = idvr.IsValid(query.id), to = idvr.IsValid(query.to), errors = ModelState });
|
||||
return this.BadRequest(new { id = idvr.IsValid(query.Id), to = idvr.IsValid(query.To), errors = ModelState });
|
||||
}
|
||||
_logger.LogInformation($"Valid move query: {query.id} => {query.to}");
|
||||
var uid = User.GetUserId();
|
||||
_logger.LogInformation($"Valid move query: {query.Id} => {query.To}");
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.Users.Single(
|
||||
u => u.Id == uid
|
||||
);
|
||||
try {
|
||||
if (Startup.UserFilesOptions.FileProvider.GetFileInfo(Path.Combine(user.UserName, query.id)).Exists)
|
||||
if (Config.UserFilesOptions.FileProvider.GetFileInfo(Path.Combine(user.UserName, query.Id)).Exists)
|
||||
{
|
||||
var result = user.MoveUserFile(query.id, query.to);
|
||||
var result = user.MoveUserFile(query.Id, query.To);
|
||||
if (!result.Done) return new BadRequestObjectResult(result);
|
||||
}
|
||||
else {
|
||||
var result = user.MoveUserDir(query.id, query.to);
|
||||
var result = user.MoveUserDir(query.Id, query.To);
|
||||
if (!result.Done) return new BadRequestObjectResult(result);
|
||||
}
|
||||
}
|
@ -1,16 +1,14 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Messaging;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
@ -19,13 +17,16 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly ILiveProcessor liveProcessor;
|
||||
private readonly IHubContext<ChatHub> hubContext;
|
||||
readonly ApplicationDbContext dbContext;
|
||||
|
||||
public FileSystemStreamController(ApplicationDbContext context, ILiveProcessor liveProcessor, ILoggerFactory loggerFactory)
|
||||
public FileSystemStreamController(ApplicationDbContext context, ILiveProcessor liveProcessor, ILoggerFactory loggerFactory,
|
||||
IHubContext<ChatHub> hubContext)
|
||||
{
|
||||
this.dbContext = context;
|
||||
this.logger = loggerFactory.CreateLogger<FileSystemStreamController>();
|
||||
this.liveProcessor = liveProcessor;
|
||||
this.hubContext = hubContext;
|
||||
}
|
||||
|
||||
[Authorize, Route("put/{filename}")]
|
||||
@ -33,28 +34,28 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
logger.LogInformation("Put : " + filename);
|
||||
if (!HttpContext.WebSockets.IsWebSocketRequest)
|
||||
return HttpBadRequest("not a web socket");
|
||||
return BadRequest("not a web socket");
|
||||
if (!HttpContext.User.Identity.IsAuthenticated)
|
||||
return new HttpUnauthorizedResult();
|
||||
return new UnauthorizedResult();
|
||||
var subdirs = filename.Split('/');
|
||||
var filePath = subdirs.Length > 1 ? string.Join("/", subdirs.Take(subdirs.Length-1)) : null;
|
||||
var shortFileName = subdirs[subdirs.Length-1];
|
||||
if (!shortFileName.IsValidShortFileName())
|
||||
{
|
||||
logger.LogInformation("invalid file name : " + filename);
|
||||
return HttpBadRequest("invalid file name");
|
||||
return BadRequest("invalid file name");
|
||||
}
|
||||
logger.LogInformation("validated: api/stream/Put: "+filename);
|
||||
var userName = User.GetUserName();
|
||||
var hubContext = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
|
||||
|
||||
string url = string.Format(
|
||||
"{0}/{1}/{2}",
|
||||
Startup.UserFilesOptions.RequestPath.ToUriComponent(),
|
||||
Config.UserFilesOptions.RequestPath.ToUriComponent(),
|
||||
userName,
|
||||
filename
|
||||
);
|
||||
|
||||
hubContext.Clients.All.addPublicStream(new PublicStreamInfo
|
||||
hubContext.Clients.All.SendAsync("addPublicStream", new PublicStreamInfo
|
||||
{
|
||||
sender = userName,
|
||||
url = url,
|
16
src/Api/Controllers/Blogspot/MoveFileQuery.cs
Normal file
16
src/Api/Controllers/Blogspot/MoveFileQuery.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using Yavsc.Attributes.Validation;
|
||||
namespace Yavsc.Models.FileSystem
|
||||
{
|
||||
|
||||
public class MoveFileQuery
|
||||
{
|
||||
[ValidRemoteUserFilePath]
|
||||
[YaStringLength(1, 512)]
|
||||
public required string Id { get; set; }
|
||||
|
||||
[YaStringLength(0, 512)]
|
||||
[ValidRemoteUserFilePath]
|
||||
public required string To { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using System.Security.Claims;
|
||||
using Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models.Blog;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("~/api/PostTagsApi")]
|
||||
@ -34,14 +36,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag postTag = _context.TagsDomain.Single(m => m.PostId == id);
|
||||
|
||||
if (postTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(postTag);
|
||||
@ -53,12 +55,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != postTag.PostId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(postTag).State = EntityState.Modified;
|
||||
@ -71,7 +73,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!PostTagExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -79,7 +81,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/PostTagsApi
|
||||
@ -88,7 +90,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.TagsDomain.Add(postTag);
|
||||
@ -100,7 +102,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (PostTagExists(postTag.PostId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,13 +119,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlogTag postTag = _context.TagsDomain.Single(m => m.PostId == id);
|
||||
if (postTag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.TagsDomain.Remove(postTag);
|
||||
@ -146,4 +148,4 @@ namespace Yavsc.Controllers
|
||||
return _context.TagsDomain.Count(e => e.PostId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
src/Api/Controllers/Blogspot/RenameFileQuery.cs
Normal file
15
src/Api/Controllers/Blogspot/RenameFileQuery.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using Yavsc.Attributes.Validation;
|
||||
namespace Yavsc.Models.FileSystem
|
||||
{
|
||||
public class RenameFileQuery
|
||||
{
|
||||
[ValidRemoteUserFilePath]
|
||||
[YaStringLength(1, 512)]
|
||||
public required string Id { get; set; }
|
||||
|
||||
[YaStringLength(0, 512)]
|
||||
[ValidRemoteUserFilePath]
|
||||
public required string To { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Data.Entity;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models.Relationship;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("api/TagsApi")]
|
||||
public class TagsApiController : Controller
|
||||
@ -37,14 +37,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Tag tag = _context.Tags.Single(m => m.Id == id);
|
||||
|
||||
if (tag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(tag);
|
||||
@ -56,12 +56,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != tag.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(tag).State = EntityState.Modified;
|
||||
@ -75,7 +75,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!TagExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -83,7 +83,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/TagsApi
|
||||
@ -92,7 +92,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Tags.Add(tag);
|
||||
@ -104,7 +104,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (TagExists(tag.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,13 +121,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Tag tag = _context.Tags.Single(m => m.Id == id);
|
||||
if (tag == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Tags.Remove(tag);
|
@ -1,5 +1,5 @@
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
@ -2,10 +2,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Workflow;
|
||||
|
||||
@ -37,14 +38,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Activity activity = await _context.Activities.SingleAsync(m => m.Code == id);
|
||||
|
||||
if (activity == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
// Also return hidden ones
|
||||
// hidden doesn't mean disabled
|
||||
@ -57,12 +58,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != activity.Code)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(activity).State = EntityState.Modified;
|
||||
@ -75,7 +76,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ActivityExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -83,7 +84,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ActivityApi
|
||||
@ -92,7 +93,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Activities.Add(activity);
|
||||
@ -104,7 +105,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ActivityExists(activity.Code))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,13 +122,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Activity activity = await _context.Activities.SingleAsync(m => m.Code == id);
|
||||
if (activity == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Activities.Remove(activity);
|
@ -1,15 +1,7 @@
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Linq;
|
||||
using Microsoft.Data.Entity;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Security.Claims;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.ViewModels;
|
||||
@ -20,7 +12,10 @@ namespace Yavsc.ApiControllers
|
||||
using Services;
|
||||
|
||||
using Models.Messaging;
|
||||
using ViewModels.Auth;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.ViewModels.Auth;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Route("api/bill"), Authorize]
|
||||
public class BillingController : Controller
|
||||
@ -38,7 +33,7 @@ namespace Yavsc.ApiControllers
|
||||
public BillingController(
|
||||
IAuthorizationService authorizationService,
|
||||
ILoggerFactory loggerFactory,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> SR,
|
||||
IStringLocalizer<Yavsc.YavscLocalization> SR,
|
||||
ApplicationDbContext context,
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IYavscMessageSender GCMSender,
|
||||
@ -59,7 +54,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
var bill = await billingService.GetBillAsync(billingCode, id);
|
||||
|
||||
if (!await authorizationService.AuthorizeAsync(User, bill, new ViewRequirement()))
|
||||
if ( authorizationService.AuthorizeAsync(User, bill, new ReadPermission()).IsFaulted)
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
@ -77,11 +72,11 @@ namespace Yavsc.ApiControllers
|
||||
|
||||
if (bill==null) {
|
||||
logger.LogCritical ( $"# not found !! {id} in {billingCode}");
|
||||
return this.HttpNotFound();
|
||||
return this.NotFound();
|
||||
}
|
||||
logger.LogVerbose(JsonConvert.SerializeObject(bill));
|
||||
logger.LogTrace(JsonConvert.SerializeObject(bill));
|
||||
|
||||
if (!await authorizationService.AuthorizeAsync(User, bill, new ViewRequirement()))
|
||||
if (!(await authorizationService.AuthorizeAsync(User, bill, new ReadPermission())).Succeeded)
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
@ -96,7 +91,7 @@ namespace Yavsc.ApiControllers
|
||||
|
||||
if (bill==null) {
|
||||
logger.LogCritical ( $"# not found !! {id} in {billingCode}");
|
||||
return this.HttpNotFound();
|
||||
return this.NotFound();
|
||||
}
|
||||
logger.LogWarning("Got bill ack:"+bill.GetIsAcquitted().ToString());
|
||||
return ViewComponent("Bill",new object[] { billingCode, bill, OutputFormat.Pdf, true } );
|
||||
@ -112,7 +107,9 @@ namespace Yavsc.ApiControllers
|
||||
.FirstOrDefault(e=>e.Id == id);
|
||||
if (estimate == null)
|
||||
return new BadRequestResult();
|
||||
if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()))
|
||||
if (!(await authorizationService.AuthorizeAsync(User, estimate, new ReadPermission())).Succeeded)
|
||||
|
||||
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
@ -138,25 +135,26 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
// For authorization purpose
|
||||
var estimate = dbContext.Estimates.FirstOrDefault(e=>e.Id == id);
|
||||
if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()))
|
||||
if (!(await authorizationService.AuthorizeAsync(User, estimate, new ReadPermission())).Succeeded)
|
||||
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
|
||||
var filename = AbstractFileSystemHelpers.SignFileNameFormat("pro", billingCode, id);
|
||||
FileInfo fi = new FileInfo(Path.Combine(AbstractFileSystemHelpers.UserBillsDirName, filename));
|
||||
if (!fi.Exists) return HttpNotFound(new { Error = "Professional signature not found" });
|
||||
if (!fi.Exists) return NotFound(new { Error = "Professional signature not found" });
|
||||
return File(fi.OpenRead(), "application/x-pdf", filename); ;
|
||||
}
|
||||
|
||||
[HttpPost("clisign/{billingCode}/{id}")]
|
||||
public async Task<IActionResult> CliSign(string billingCode, long id)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var estimate = dbContext.Estimates.Include( e=>e.Query
|
||||
).Include(e=>e.Owner).Include(e=>e.Owner.Performer).Include(e=>e.Client)
|
||||
.FirstOrDefault( e=> e.Id == id && e.Query.ClientId == uid );
|
||||
if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()))
|
||||
if (!(await authorizationService.AuthorizeAsync(User, estimate, new ReadPermission())).Succeeded)
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
@ -173,14 +171,14 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
// For authorization purpose
|
||||
var estimate = dbContext.Estimates.FirstOrDefault(e=>e.Id == id);
|
||||
if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()))
|
||||
if (!(await authorizationService.AuthorizeAsync(User, estimate, new ReadPermission())).Succeeded)
|
||||
{
|
||||
return new ChallengeResult();
|
||||
}
|
||||
|
||||
var filename = AbstractFileSystemHelpers.SignFileNameFormat("pro", billingCode, id);
|
||||
FileInfo fi = new FileInfo(Path.Combine(AbstractFileSystemHelpers.UserBillsDirName, filename));
|
||||
if (!fi.Exists) return HttpNotFound(new { Error = "Professional signature not found" });
|
||||
if (!fi.Exists) return NotFound(new { Error = "Professional signature not found" });
|
||||
return File(fi.OpenRead(), "application/x-pdf", filename); ;
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
@ -14,9 +13,12 @@ namespace Yavsc.Controllers
|
||||
using Yavsc.Models.Workflow;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("api/bookquery"), Authorize(Roles = "Performer,Administrator")]
|
||||
[Route("api/bookquery"), Authorize("Performer")]
|
||||
public class BookQueryApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
@ -37,7 +39,7 @@ namespace Yavsc.Controllers
|
||||
[HttpGet]
|
||||
public IEnumerable<RdvQueryProviderInfo> GetCommands(long maxId=long.MaxValue)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var now = DateTime.Now;
|
||||
|
||||
var result = _context.RdvQueries.Include(c => c.Location).
|
||||
@ -69,15 +71,15 @@ namespace Yavsc.Controllers
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
RdvQuery bookQuery = _context.RdvQueries.Where(c => c.ClientId == uid || c.PerformerId == uid).Single(m => m.Id == id);
|
||||
|
||||
if (bookQuery == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(bookQuery);
|
||||
@ -89,16 +91,16 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != bookQuery.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (bookQuery.ClientId != uid)
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
|
||||
_context.Entry(bookQuery).State = EntityState.Modified;
|
||||
|
||||
@ -110,7 +112,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!BookQueryExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,7 +120,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BookQueryApi
|
||||
@ -127,9 +129,9 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (bookQuery.ClientId != uid)
|
||||
{
|
||||
ModelState.AddModelError("ClientId", "You must be the client at creating a book query");
|
||||
@ -144,7 +146,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (BookQueryExists(bookQuery.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -161,16 +163,16 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
RdvQuery bookQuery = _context.RdvQueries.Single(m => m.Id == id);
|
||||
|
||||
if (bookQuery == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
if (bookQuery.ClientId != uid) return HttpNotFound();
|
||||
if (bookQuery.ClientId != uid) return NotFound();
|
||||
|
||||
_context.RdvQueries.Remove(bookQuery);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
@ -192,4 +194,4 @@ namespace Yavsc.Controllers
|
||||
return _context.RdvQueries.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,21 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/estimate"), Authorize()]
|
||||
[Route("api/estimate"), Authorize]
|
||||
public class EstimateApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
@ -36,12 +38,12 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
// GET: api/Estimate{?ownerId=User.GetUserId()}
|
||||
[HttpGet]
|
||||
public IActionResult GetEstimates(string ownerId = null)
|
||||
public IActionResult GetEstimates(string? ownerId = null)
|
||||
{
|
||||
if (ownerId == null) ownerId = User.GetUserId();
|
||||
else if (!UserIsAdminOrThis(ownerId)) // throw new Exception("Not authorized") ;
|
||||
// or just do nothing
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return new StatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return Ok(_context.Estimates.Include(e => e.Bill).Where(e => e.OwnerId == ownerId));
|
||||
}
|
||||
// GET: api/Estimate/5
|
||||
@ -50,19 +52,19 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Estimate estimate = _context.Estimates.Include(e => e.Bill).Single(m => m.Id == id);
|
||||
|
||||
if (estimate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (UserIsAdminOrInThese(estimate.ClientId, estimate.OwnerId))
|
||||
return Ok(estimate);
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return new StatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
}
|
||||
|
||||
// PUT: api/Estimate/5
|
||||
@ -77,15 +79,15 @@ namespace Yavsc.Controllers
|
||||
|
||||
if (id != estimate.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
ModelState.AddModelError("OwnerId", "You can only modify your own estimates");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +100,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!EstimateExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -113,7 +115,7 @@ namespace Yavsc.Controllers
|
||||
[HttpPost, Produces("application/json")]
|
||||
public IActionResult PostEstimate([FromBody] Estimate estimate)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimate.OwnerId == null) estimate.OwnerId = uid;
|
||||
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
@ -121,7 +123,7 @@ namespace Yavsc.Controllers
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
ModelState.AddModelError("OwnerId", "You can only create your own estimates");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +132,7 @@ namespace Yavsc.Controllers
|
||||
var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
||||
if (query == null)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
query.ValidationDate = DateTime.Now;
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
@ -159,7 +161,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (EstimateExists(estimate.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -175,22 +177,22 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Estimate estimate = _context.Estimates.Include(e => e.Bill).Single(m => m.Id == id);
|
||||
|
||||
if (estimate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
ModelState.AddModelError("OwnerId", "You can only create your own estimates");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
}
|
||||
_context.Estimates.Remove(estimate);
|
@ -1,11 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -24,7 +23,7 @@ namespace Yavsc.Controllers
|
||||
[HttpGet]
|
||||
public IEnumerable<EstimateTemplate> GetEstimateTemplate()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
return _context.EstimateTemplates.Where(x=>x.OwnerId==uid);
|
||||
}
|
||||
|
||||
@ -34,15 +33,15 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
EstimateTemplate estimateTemplate = _context.EstimateTemplates.Where(x=>x.OwnerId==uid).Single(m => m.Id == id);
|
||||
|
||||
if (estimateTemplate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(estimateTemplate);
|
||||
@ -54,17 +53,17 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != estimateTemplate.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimateTemplate.OwnerId!=uid)
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return new StatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
|
||||
_context.Entry(estimateTemplate).State = EntityState.Modified;
|
||||
|
||||
@ -76,7 +75,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!EstimateTemplateExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -84,7 +83,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/EstimateTemplatesApi
|
||||
@ -93,7 +92,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
estimateTemplate.OwnerId=User.GetUserId();
|
||||
|
||||
@ -106,7 +105,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (EstimateTemplateExists(estimateTemplate.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -123,18 +122,18 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
EstimateTemplate estimateTemplate = _context.EstimateTemplates.Single(m => m.Id == id);
|
||||
if (estimateTemplate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimateTemplate.OwnerId!=uid)
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
return new StatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
|
||||
_context.EstimateTemplates.Remove(estimateTemplate);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
@ -156,4 +155,4 @@ namespace Yavsc.Controllers
|
||||
return _context.EstimateTemplates.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
src/Api/Controllers/Business/FrontOfficeApiController.cs
Normal file
56
src/Api/Controllers/Business/FrontOfficeApiController.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.ViewModels.FrontOffice;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
[Route("api/front")]
|
||||
public class FrontOfficeApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
|
||||
private IBillingService billing;
|
||||
|
||||
public FrontOfficeApiController(ApplicationDbContext context, IBillingService billing)
|
||||
{
|
||||
dbContext = context;
|
||||
this.billing = billing;
|
||||
}
|
||||
|
||||
[HttpGet("profiles/{actCode}")]
|
||||
async Task <IEnumerable<PerformerProfileViewModel>> Profiles(string actCode)
|
||||
{
|
||||
return await dbContext.ListPerformersAsync(billing, actCode);
|
||||
}
|
||||
|
||||
[HttpPost("query/reject")]
|
||||
public IActionResult RejectQuery(string billingCode, long queryId)
|
||||
{
|
||||
if (billingCode == null) return BadRequest("billingCode");
|
||||
if (queryId == 0) return BadRequest("queryId");
|
||||
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
||||
if (billing == null) return BadRequest();
|
||||
billing.Decided = true;
|
||||
billing.Accepted = false;
|
||||
dbContext.SaveChanges();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost("query/accept")]
|
||||
public IActionResult AcceptQuery(string billingCode, long queryId)
|
||||
{
|
||||
if (billingCode == null) return BadRequest("billingCode");
|
||||
if (queryId == 0) return BadRequest("queryId");
|
||||
var billing = BillingService.GetBillable(dbContext, billingCode, queryId);
|
||||
if (billing == null) return BadRequest();
|
||||
billing.Accepted = true;
|
||||
billing.Decided = true;
|
||||
dbContext.SaveChanges();
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
@ -1,12 +1,11 @@
|
||||
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Services;
|
||||
@ -29,7 +28,7 @@ namespace Yavsc.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles="Performer"),HttpGet("{id}")]
|
||||
[Authorize("Performer"),HttpGet("{id}")]
|
||||
public IActionResult Get(string id)
|
||||
{
|
||||
var pfr = dbContext.Performers.Include(
|
||||
@ -44,7 +43,7 @@ namespace Yavsc.Controllers
|
||||
ModelState.AddModelError("id","Specifier un identifiant de prestataire valide");
|
||||
}
|
||||
else {
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInRole("Administrator"))
|
||||
if (uid != id) return new ChallengeResult();
|
||||
|
||||
@ -58,9 +57,9 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("doing/{id}"),AllowAnonymous]
|
||||
public IActionResult ListPerformers(string id)
|
||||
public async Task<IActionResult> ListPerformers(string id)
|
||||
{
|
||||
return Ok(dbContext.ListPerformers(billing, id));
|
||||
return Ok(await dbContext.ListPerformersAsync(billing, id));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Market;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,14 +32,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Product product = _context.Products.Single(m => m.Id == id);
|
||||
|
||||
if (product == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(product);
|
||||
@ -53,12 +51,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != product.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(product).State = EntityState.Modified;
|
||||
@ -71,7 +69,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ProductExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -79,7 +77,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ProductApi
|
||||
@ -88,7 +86,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Products.Add(product);
|
||||
@ -100,7 +98,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ProductExists(product.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,13 +115,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Product product = _context.Products.Single(m => m.Id == id);
|
||||
if (product == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Products.Remove(product);
|
175
src/Api/Controllers/DimissClicksApiController.cs
Normal file
175
src/Api/Controllers/DimissClicksApiController.cs
Normal file
@ -0,0 +1,175 @@
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Messaging;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/dimiss")]
|
||||
public class DimissClicksApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public DimissClicksApiController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/DimissClicksApi
|
||||
[HttpGet]
|
||||
public IEnumerable<DismissClicked> GetDismissClicked()
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
return _context.DismissClicked.Where(d=>d.UserId == uid);
|
||||
}
|
||||
|
||||
[HttpGet("click/{noteid}"),AllowAnonymous]
|
||||
public async Task<IActionResult> Click(long noteid )
|
||||
{
|
||||
if (User.IsSignedIn())
|
||||
return await PostDismissClicked(new DismissClicked { NotificationId= noteid, UserId = User.GetUserId()});
|
||||
await HttpContext.Session.LoadAsync();
|
||||
var clicked = HttpContext.Session.GetString("clicked");
|
||||
if (clicked == null) {
|
||||
HttpContext.Session.SetString("clicked",noteid.ToString());
|
||||
} else HttpContext.Session.SetString("clicked",$"{clicked}:{noteid}");
|
||||
await HttpContext.Session.CommitAsync();
|
||||
return Ok();
|
||||
}
|
||||
// GET: api/DimissClicksApi/5
|
||||
[HttpGet("{id}", Name = "GetDismissClicked")]
|
||||
public async Task<IActionResult> GetDismissClicked([FromRoute] string id)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (uid != id) return new ChallengeResult();
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
DismissClicked DismissClicked = await _context.DismissClicked.SingleAsync(m => m.UserId == id);
|
||||
|
||||
if (DismissClicked == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(DismissClicked);
|
||||
}
|
||||
|
||||
// PUT: api/DimissClicksApi/5
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutDismissClicked([FromRoute] string id, [FromBody] DismissClicked DismissClicked)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (uid != id || uid != DismissClicked.UserId) return new ChallengeResult();
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != DismissClicked.UserId)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(DismissClicked).State = EntityState.Modified;
|
||||
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!DismissClickedExists(id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/DimissClicksApi
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostDismissClicked([FromBody] DismissClicked DismissClicked)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (uid != DismissClicked.UserId) return new ChallengeResult();
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.DismissClicked.Add(DismissClicked);
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
}
|
||||
catch (DbUpdateException)
|
||||
{
|
||||
if (DismissClickedExists(DismissClicked.UserId))
|
||||
{
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return CreatedAtRoute("GetDismissClicked", new { id = DismissClicked.UserId }, DismissClicked);
|
||||
}
|
||||
|
||||
// DELETE: api/DimissClicksApi/5
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteDismissClicked([FromRoute] string id)
|
||||
{
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInRole("Administrator"))
|
||||
if (uid != id) return new ChallengeResult();
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
DismissClicked DismissClicked = await _context.DismissClicked.SingleAsync(m => m.UserId == id);
|
||||
if (DismissClicked == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.DismissClicked.Remove(DismissClicked);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
||||
|
||||
return Ok(DismissClicked);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_context.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private bool DismissClickedExists(string id)
|
||||
{
|
||||
return _context.DismissClicked.Count(e => e.UserId == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,14 +31,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BrusherProfile brusherProfile = await _context.BrusherProfile.SingleAsync(m => m.UserId == id);
|
||||
|
||||
if (brusherProfile == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(brusherProfile);
|
||||
@ -53,17 +50,17 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != brusherProfile.UserId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
if (id != User.GetUserId())
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
_context.Entry(brusherProfile).State = EntityState.Modified;
|
||||
|
||||
@ -75,7 +72,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!BrusherProfileExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -83,7 +80,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BursherProfilesApi
|
||||
@ -92,7 +89,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.BrusherProfile.Add(brusherProfile);
|
||||
@ -104,7 +101,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (BrusherProfileExists(brusherProfile.UserId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,13 +118,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BrusherProfile brusherProfile = await _context.BrusherProfile.SingleAsync(m => m.UserId == id);
|
||||
if (brusherProfile == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.BrusherProfile.Remove(brusherProfile);
|
@ -1,6 +1,5 @@
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
|
||||
@ -16,14 +15,16 @@ namespace Yavsc.ApiControllers
|
||||
using Models.Haircut;
|
||||
using System.Threading.Tasks;
|
||||
using Helpers;
|
||||
using Microsoft.Data.Entity;
|
||||
using Models.Payment;
|
||||
using Newtonsoft.Json;
|
||||
using PayPal.PayPalAPIInterfaceService.Model;
|
||||
using Yavsc.Models.Haircut.Views;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Route("api/haircut")]
|
||||
[Route("api/haircut")][Authorize]
|
||||
public class HairCutController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
@ -40,7 +41,9 @@ namespace Yavsc.ApiControllers
|
||||
// user, as a client
|
||||
public IActionResult Index()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
var now = DateTime.Now;
|
||||
var result = _context.HairCutQueries
|
||||
.Include(q => q.Prestation)
|
||||
@ -61,14 +64,14 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
HairCutQuery hairCutQuery = await _context.HairCutQueries.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (hairCutQuery == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(hairCutQuery);
|
||||
@ -80,12 +83,12 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != hairCutQuery.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(hairCutQuery).State = EntityState.Modified;
|
||||
@ -98,7 +101,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!HairCutQueryExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -106,20 +109,20 @@ namespace Yavsc.ApiControllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostQuery(HairCutQuery hairCutQuery)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return new BadRequestObjectResult(ModelState);
|
||||
}
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.HairCutQueries.Add(hairCutQuery);
|
||||
@ -131,7 +134,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (HairCutQueryExists(hairCutQuery.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -159,13 +162,13 @@ namespace Yavsc.ApiControllers
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex.Message);
|
||||
return new HttpStatusCodeResult(500);
|
||||
return new StatusCodeResult(500);
|
||||
}
|
||||
|
||||
if (payment==null) {
|
||||
_logger.LogError("Error doing SetExpressCheckout, aborting.");
|
||||
_logger.LogError(JsonConvert.SerializeObject(Startup.PayPalSettings));
|
||||
return new HttpStatusCodeResult(500);
|
||||
_logger.LogError(JsonConvert.SerializeObject(Config.PayPalSettings));
|
||||
return new StatusCodeResult(500);
|
||||
}
|
||||
switch (payment.Ack)
|
||||
{
|
||||
@ -195,13 +198,13 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
HairCutQuery hairCutQuery = await _context.HairCutQueries.SingleAsync(m => m.Id == id);
|
||||
if (hairCutQuery == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.HairCutQueries.Remove(hairCutQuery);
|
@ -1,9 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Relationship;
|
||||
|
||||
@ -33,14 +29,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||
|
||||
if (hyperLink == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(hyperLink);
|
||||
@ -52,12 +48,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != hyperLink.HRef)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(hyperLink).State = EntityState.Modified;
|
||||
@ -70,7 +66,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!HyperLinkExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -78,7 +74,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/HyperLinkApi
|
||||
@ -87,7 +83,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.HyperLink.Add(hyperLink);
|
||||
@ -99,7 +95,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (HyperLinkExists(hyperLink.HRef))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -116,13 +112,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
HyperLink hyperLink = await _context.HyperLink.SingleAsync(m => m.HRef == id);
|
||||
if (hyperLink == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.HyperLink.Remove(hyperLink);
|
@ -1,10 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Models.IT.SourceCode;
|
||||
|
||||
@ -35,14 +31,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
GitRepositoryReference gitRepositoryReference = await _context.GitRepositoryReference.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (gitRepositoryReference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(gitRepositoryReference);
|
||||
@ -54,7 +50,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Entry(gitRepositoryReference).State = EntityState.Modified;
|
||||
@ -67,7 +63,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!GitRepositoryReferenceExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -75,7 +71,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/GitRefsApi
|
||||
@ -84,7 +80,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.GitRepositoryReference.Add(gitRepositoryReference);
|
||||
@ -96,7 +92,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (GitRepositoryReferenceExists(gitRepositoryReference.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -113,13 +109,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
GitRepositoryReference gitRepositoryReference = await _context.GitRepositoryReference.SingleAsync(m => m.Id == id);
|
||||
if (gitRepositoryReference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.GitRepositoryReference.Remove(gitRepositoryReference);
|
||||
@ -142,4 +138,4 @@ namespace Yavsc.Controllers
|
||||
return _context.GitRepositoryReference.Count(e => e.Id == id) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
@ -1,13 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Models.EMailing;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -32,18 +27,18 @@ namespace Yavsc.Controllers
|
||||
|
||||
// GET: api/MailingTemplateApi/5
|
||||
[HttpGet("{id}", Name = "GetMailingTemplate")]
|
||||
public async Task<IActionResult> GetMailingTemplate([FromRoute] long id)
|
||||
public async Task<IActionResult> GetMailingTemplate([FromRoute] string id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
MailingTemplate mailingTemplate = await _context.MailingTemplate.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (mailingTemplate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(mailingTemplate);
|
||||
@ -51,16 +46,16 @@ namespace Yavsc.Controllers
|
||||
|
||||
// PUT: api/MailingTemplateApi/5
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutMailingTemplate([FromRoute] long id, [FromBody] MailingTemplate mailingTemplate)
|
||||
public async Task<IActionResult> PutMailingTemplate([FromRoute] string id, [FromBody] MailingTemplate mailingTemplate)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != mailingTemplate.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(mailingTemplate).State = EntityState.Modified;
|
||||
@ -73,7 +68,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!MailingTemplateExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -81,18 +76,16 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/MailingTemplateApi
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostMailingTemplate([FromBody] MailingTemplate mailingTemplate)
|
||||
{
|
||||
mailingTemplate.ManagerId = User.GetUserId();
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.MailingTemplate.Add(mailingTemplate);
|
||||
@ -104,7 +97,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (MailingTemplateExists(mailingTemplate.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,17 +110,17 @@ namespace Yavsc.Controllers
|
||||
|
||||
// DELETE: api/MailingTemplateApi/5
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteMailingTemplate([FromRoute] long id)
|
||||
public async Task<IActionResult> DeleteMailingTemplate([FromRoute] string id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
MailingTemplate mailingTemplate = await _context.MailingTemplate.SingleAsync(m => m.Id == id);
|
||||
if (mailingTemplate == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.MailingTemplate.Remove(mailingTemplate);
|
||||
@ -145,7 +138,7 @@ namespace Yavsc.Controllers
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private bool MailingTemplateExists(long id)
|
||||
private bool MailingTemplateExists(string id)
|
||||
{
|
||||
return _context.MailingTemplate.Count(e => e.Id == id) > 0;
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Musical;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -33,14 +31,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
MusicalPreference musicalPreference = _context.MusicalPreference.Single(m => m.OwnerProfileId == id);
|
||||
|
||||
if (musicalPreference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(musicalPreference);
|
||||
@ -51,12 +49,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != musicalPreference.OwnerProfileId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(musicalPreference).State = EntityState.Modified;
|
||||
@ -69,7 +67,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!MusicalPreferenceExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -77,7 +75,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/MusicalPreferencesApi
|
||||
@ -86,7 +84,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.MusicalPreference.Add(musicalPreference);
|
||||
@ -98,7 +96,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (MusicalPreferenceExists(musicalPreference.OwnerProfileId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -115,13 +113,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
MusicalPreference musicalPreference = _context.MusicalPreference.Single(m => m.OwnerProfileId == id);
|
||||
if (musicalPreference == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.MusicalPreference.Remove(musicalPreference);
|
@ -1,11 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Musical;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -33,14 +31,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||
|
||||
if (musicalTendency == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(musicalTendency);
|
||||
@ -52,12 +50,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != musicalTendency.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(musicalTendency).State = EntityState.Modified;
|
||||
@ -70,7 +68,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!MusicalTendencyExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -78,7 +76,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/MusicalTendenciesApi
|
||||
@ -87,7 +85,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.MusicalTendency.Add(musicalTendency);
|
||||
@ -99,7 +97,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (MusicalTendencyExists(musicalTendency.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -116,13 +114,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id);
|
||||
if (musicalTendency == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.MusicalTendency.Remove(musicalTendency);
|
8
src/Api/Controllers/Musical/PodcastController.cs
Normal file
8
src/Api/Controllers/Musical/PodcastController.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
public class PodcastController : Controller
|
||||
{
|
||||
}
|
||||
}
|
@ -2,11 +2,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Identity;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Authorize, Route("~/api/gcm")]
|
||||
public class NativeConfidentialController : Controller
|
||||
@ -30,8 +32,9 @@ public class NativeConfidentialController : Controller
|
||||
public IActionResult Register(
|
||||
[FromBody] DeviceDeclaration declaration)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (uid == null)
|
||||
throw new InvalidOperationException("no name identifier from claims");
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
_logger.LogError("Invalid model for GCMD");
|
||||
@ -40,12 +43,15 @@ public class NativeConfidentialController : Controller
|
||||
declaration.LatestActivityUpdate = DateTime.Now;
|
||||
|
||||
_logger.LogInformation($"Registering device with id:{declaration.DeviceId} for {uid}");
|
||||
var alreadyRegisteredDevice = _context.DeviceDeclaration.FirstOrDefault(d => d.DeviceId == declaration.DeviceId);
|
||||
DeviceDeclaration? alreadyRegisteredDevice = _context.DeviceDeclaration.FirstOrDefault(d => d.DeviceId == declaration.DeviceId);
|
||||
var deviceAlreadyRegistered = (alreadyRegisteredDevice!=null);
|
||||
if (deviceAlreadyRegistered)
|
||||
if (alreadyRegisteredDevice==null)
|
||||
{
|
||||
_logger.LogInformation($"deviceAlreadyRegistered");
|
||||
// Override an exiting owner
|
||||
declaration.DeclarationDate = DateTime.Now;
|
||||
declaration.DeviceOwnerId = uid;
|
||||
_context.DeviceDeclaration.Add(declaration);
|
||||
}
|
||||
else {
|
||||
alreadyRegisteredDevice.DeviceOwnerId = uid;
|
||||
alreadyRegisteredDevice.Model = declaration.Model;
|
||||
alreadyRegisteredDevice.Platform = declaration.Platform;
|
||||
@ -53,18 +59,13 @@ public class NativeConfidentialController : Controller
|
||||
_context.Update(alreadyRegisteredDevice);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"new device");
|
||||
declaration.DeclarationDate = DateTime.Now;
|
||||
declaration.DeviceOwnerId = uid;
|
||||
_context.DeviceDeclaration.Add(declaration as DeviceDeclaration);
|
||||
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
}
|
||||
|
||||
var latestActivityUpdate = _context.Activities.Max(a=>a.DateModified);
|
||||
return Json(new {
|
||||
IsAnUpdate = deviceAlreadyRegistered,
|
||||
UpdateActivities = (latestActivityUpdate != declaration.LatestActivityUpdate)
|
||||
UpdateActivities = latestActivityUpdate != declaration.LatestActivityUpdate
|
||||
});
|
||||
}
|
||||
|
48
src/Api/Controllers/PostRateApiController.cs
Normal file
48
src/Api/Controllers/PostRateApiController.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("~/api/PostRateApi")]
|
||||
public class PostRateApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public PostRateApiController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/PostRateApi/5
|
||||
[HttpPut("{id}"),Authorize]
|
||||
public IActionResult PutPostRate([FromRoute] long id, [FromBody] int rate)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Models.Blog.BlogPost blogpost = _context.BlogSpot.Single(x=>x.Id == id);
|
||||
|
||||
if (blogpost == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (blogpost.AuthorId!=uid)
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return BadRequest();
|
||||
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
17
src/Api/Controllers/ProfileApiController.cs
Normal file
17
src/Api/Controllers/ProfileApiController.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
using Models;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for managing performers profiles
|
||||
/// </summary>
|
||||
[Produces("application/json"),Route("api/profile")]
|
||||
public abstract class ProfileApiController<T> : Controller
|
||||
{ public ProfileApiController()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Access;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,22 +33,22 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
BlackListed blackListed = _context.BlackListed.Single(m => m.Id == id);
|
||||
if (blackListed == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
if (!CheckPermission(blackListed))
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
|
||||
return Ok(blackListed);
|
||||
}
|
||||
|
||||
private bool CheckPermission(BlackListed blackListed)
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (uid != blackListed.OwnerId)
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
if (!User.IsInRole(Constants.FrontOfficeGroupName))
|
||||
@ -62,15 +61,15 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != blackListed.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
if (!CheckPermission(blackListed))
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
_context.Entry(blackListed).State = EntityState.Modified;
|
||||
|
||||
try
|
||||
@ -81,7 +80,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!BlackListedExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -89,7 +88,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/BlackListApi
|
||||
@ -98,11 +97,11 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (!CheckPermission(blackListed))
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
|
||||
_context.BlackListed.Add(blackListed);
|
||||
try
|
||||
@ -113,7 +112,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (BlackListedExists(blackListed.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -130,17 +129,17 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
BlackListed blackListed = _context.BlackListed.Single(m => m.Id == id);
|
||||
if (blackListed == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (!CheckPermission(blackListed))
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
|
||||
_context.BlackListed.Remove(blackListed);
|
||||
_context.SaveChanges(User.GetUserId());
|
@ -1,12 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Access;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,15 +32,15 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.CircleAuthorizationToBlogPost.SingleAsync(
|
||||
m => m.CircleId == id && m.Allowed.OwnerId == uid );
|
||||
|
||||
if (circleAuthorizationToBlogPost == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(circleAuthorizationToBlogPost);
|
||||
@ -54,12 +52,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != circleAuthorizationToBlogPost.CircleId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
if (!CheckOwner(circleAuthorizationToBlogPost.CircleId))
|
||||
@ -76,7 +74,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!CircleAuthorizationToBlogPostExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -84,12 +82,12 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
private bool CheckOwner (long circleId)
|
||||
{
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var circle = _context.Circle.First(c=>c.Id==circleId);
|
||||
_context.Entry(circle).State = EntityState.Detached;
|
||||
return (circle.OwnerId == uid);
|
||||
@ -100,7 +98,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
if (!CheckOwner(circleAuthorizationToBlogPost.CircleId))
|
||||
{
|
||||
@ -115,7 +113,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (CircleAuthorizationToBlogPostExists(circleAuthorizationToBlogPost.CircleId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -132,9 +130,9 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
CircleAuthorizationToBlogPost circleAuthorizationToBlogPost = await _context.CircleAuthorizationToBlogPost.Include(
|
||||
a=>a.Allowed
|
||||
@ -142,7 +140,7 @@ namespace Yavsc.Controllers
|
||||
&& m.Allowed.OwnerId == uid);
|
||||
if (circleAuthorizationToBlogPost == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
_context.CircleAuthorizationToBlogPost.Remove(circleAuthorizationToBlogPost);
|
||||
await _context.SaveChangesAsync(User.GetUserId());
|
@ -1,13 +1,10 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Data.Entity;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.ViewModels.Chat;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -72,12 +69,12 @@ namespace Yavsc.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
// Miguel mech profiler
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var user = dbContext.ApplicationUser.Include(u => u.Connections).FirstOrDefault(u => u.UserName == userName);
|
||||
|
||||
if (user == null) return HttpNotFound();
|
||||
if (user == null) return NotFound();
|
||||
|
||||
return Ok(new ChatUserInfo
|
||||
{
|
@ -1,13 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Chat;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -35,7 +32,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
ChatRoomAccess chatRoomAccess = await _context.ChatRoomAccess.SingleAsync(m => m.ChannelName == id);
|
||||
@ -44,16 +41,16 @@ namespace Yavsc.Controllers
|
||||
|
||||
if (chatRoomAccess == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (uid != chatRoomAccess.UserId && uid != chatRoomAccess.Room.OwnerId
|
||||
&& ! User.IsInRole(Constants.AdminGroupName))
|
||||
&& ! User.IsInMsRole(Constants.AdminGroupName))
|
||||
|
||||
{
|
||||
ModelState.AddModelError("UserId","get refused");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
return Ok(chatRoomAccess);
|
||||
@ -65,20 +62,20 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
if (id != chatRoomAccess.ChannelName)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
var room = _context.ChatRoom.First(channel => channel.Name == chatRoomAccess.ChannelName );
|
||||
|
||||
if (uid != room.OwnerId && ! User.IsInRole(Constants.AdminGroupName))
|
||||
if (uid != room.OwnerId && ! User.IsInMsRole(Constants.AdminGroupName))
|
||||
{
|
||||
ModelState.AddModelError("ChannelName", "access put refused");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Entry(chatRoomAccess).State = EntityState.Modified;
|
||||
@ -91,7 +88,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ChatRoomAccessExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -99,7 +96,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ChatRoomAccessApi
|
||||
@ -108,15 +105,15 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var room = _context.ChatRoom.First(channel => channel.Name == chatRoomAccess.ChannelName );
|
||||
if (room == null || (uid != room.OwnerId && ! User.IsInRole(Constants.AdminGroupName)))
|
||||
if (room == null || (uid != room.OwnerId && ! User.IsInMsRole(Constants.AdminGroupName)))
|
||||
{
|
||||
ModelState.AddModelError("ChannelName", "access post refused");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.ChatRoomAccess.Add(chatRoomAccess);
|
||||
@ -129,7 +126,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ChatRoomAccessExists(chatRoomAccess.ChannelName))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -146,21 +143,21 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
ChatRoomAccess chatRoomAccess = await _context.ChatRoomAccess.Include(acc => acc.Room).SingleAsync(m => m.ChannelName == id);
|
||||
if (chatRoomAccess == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var room = _context.ChatRoom.First(channel => channel.Name == chatRoomAccess.ChannelName );
|
||||
if (room == null || (uid != room.OwnerId && chatRoomAccess.UserId != uid && ! User.IsInRole(Constants.AdminGroupName)))
|
||||
if (room == null || (uid != room.OwnerId && chatRoomAccess.UserId != uid && ! User.IsInMsRole(Constants.AdminGroupName)))
|
||||
{
|
||||
ModelState.AddModelError("UserId", "access drop refused");
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.ChatRoomAccess.Remove(chatRoomAccess);
|
@ -1,12 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Chat;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,14 +31,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
ChatRoom chatRoom = await _context.ChatRoom.SingleAsync(m => m.Name == id);
|
||||
|
||||
if (chatRoom == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(chatRoom);
|
||||
@ -53,17 +50,17 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != chatRoom.Name)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
if (User.GetUserId() != chatRoom.OwnerId )
|
||||
{
|
||||
return HttpBadRequest(new {error = "OwnerId"});
|
||||
return BadRequest(new {error = "OwnerId"});
|
||||
}
|
||||
|
||||
_context.Entry(chatRoom).State = EntityState.Modified;
|
||||
@ -76,7 +73,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ChatRoomExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -84,7 +81,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ChatRoomApi
|
||||
@ -93,12 +90,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (User.GetUserId() != chatRoom.OwnerId )
|
||||
{
|
||||
return HttpBadRequest(new {error = "OwnerId"});
|
||||
return BadRequest(new {error = "OwnerId"});
|
||||
}
|
||||
|
||||
_context.ChatRoom.Add(chatRoom);
|
||||
@ -110,7 +107,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ChatRoomExists(chatRoom.Name))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -127,7 +124,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
ChatRoom chatRoom = await _context.ChatRoom.SingleAsync(m => m.Name == id);
|
||||
|
||||
@ -135,13 +132,13 @@ namespace Yavsc.Controllers
|
||||
|
||||
if (chatRoom == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (User.GetUserId() != chatRoom.OwnerId )
|
||||
{
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return HttpBadRequest(new {error = "OwnerId"});
|
||||
if (!User.IsInMsRole(Constants.AdminGroupName))
|
||||
return BadRequest(new {error = "OwnerId"});
|
||||
}
|
||||
|
||||
_context.ChatRoom.Remove(chatRoom);
|
@ -1,12 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Relationship;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,14 +31,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (circle == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(circle);
|
||||
@ -53,12 +50,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != circle.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(circle).State = EntityState.Modified;
|
||||
@ -71,7 +68,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!CircleExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -79,7 +76,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/CircleApi
|
||||
@ -88,7 +85,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Circle.Add(circle);
|
||||
@ -100,7 +97,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (CircleExists(circle.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,13 +114,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Circle circle = await _context.Circle.SingleAsync(m => m.Id == id);
|
||||
if (circle == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Circle.Remove(circle);
|
@ -1,10 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -32,12 +31,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != clientProviderInfo.UserId)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(clientProviderInfo).State = EntityState.Modified;
|
||||
@ -50,7 +49,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ClientProviderInfoExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -58,7 +57,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ContactsApi
|
||||
@ -67,7 +66,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.ClientProviderInfo.Add(clientProviderInfo);
|
||||
@ -79,7 +78,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ClientProviderInfoExists(clientProviderInfo.UserId))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -96,13 +95,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
ClientProviderInfo clientProviderInfo = _context.ClientProviderInfo.Single(m => m.UserId == id);
|
||||
if (clientProviderInfo == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.ClientProviderInfo.Remove(clientProviderInfo);
|
@ -1,12 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Market;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -34,14 +32,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Service service = _context.Services.Single(m => m.Id == id);
|
||||
|
||||
if (service == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(service);
|
||||
@ -53,12 +51,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != service.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(service).State = EntityState.Modified;
|
||||
@ -71,7 +69,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ServiceExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -79,7 +77,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ServiceApi
|
||||
@ -88,7 +86,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Services.Add(service);
|
||||
@ -100,7 +98,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ServiceExists(service.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,13 +115,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Service service = _context.Services.Single(m => m.Id == id);
|
||||
if (service == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Services.Remove(service);
|
@ -1,14 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.IT.Fixing;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
@ -73,14 +68,14 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||
|
||||
if (bug == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(bug);
|
||||
@ -92,12 +87,12 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != bug.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(bug).State = EntityState.Modified;
|
||||
@ -110,7 +105,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!BugExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,7 +113,7 @@ namespace Yavsc.ApiControllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/bug
|
||||
@ -127,7 +122,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Bug.Add(bug);
|
||||
@ -139,7 +134,7 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (BugExists(bug.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -156,13 +151,13 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||
if (bug == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Bug.Remove(bug);
|
87
src/Api/Controllers/accounting/AccountController.cs
Normal file
87
src/Api/Controllers/accounting/AccountController.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Api.Helpers;
|
||||
using Yavsc.Server.Helpers;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Yavsc.WebApi.Controllers
|
||||
{
|
||||
[Route("~/api/account")]
|
||||
[Authorize("ApiScope")]
|
||||
public class ApiAccountController : Controller
|
||||
{
|
||||
readonly ApplicationDbContext _dbContext;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ApiAccountController(
|
||||
ILoggerFactory loggerFactory, ApplicationDbContext dbContext)
|
||||
{
|
||||
_logger = loggerFactory.CreateLogger(nameof(ApiAccountController));
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
[HttpGet("me")]
|
||||
public async Task<IActionResult> Me()
|
||||
{
|
||||
if (User == null)
|
||||
return new BadRequestObjectResult(
|
||||
new { error = "user not found" });
|
||||
var uid = User.GetUserId();
|
||||
Debug.Assert(uid != null, "uid is null");
|
||||
var userData = await GetUserData(uid);
|
||||
Debug.Assert(userData != null, "userData is null");
|
||||
var user = new Yavsc.Models.Auth.Me(userData.Id, userData.UserName, userData.Email,
|
||||
userData.Avatar,
|
||||
userData.PostalAddress, userData.DedicatedGoogleCalendar);
|
||||
|
||||
var userRoles = _dbContext.UserRoles.Where(u => u.UserId == uid).Select(r => r.RoleId).ToArray();
|
||||
|
||||
IdentityRole[] roles = _dbContext.Roles.Where(r => userRoles.Contains(r.Id)).ToArray();
|
||||
|
||||
user.Roles = roles.Select(r => r.Name).ToArray();
|
||||
|
||||
return Ok(user);
|
||||
}
|
||||
|
||||
private async Task<ApplicationUser> GetUserData(string uid)
|
||||
{
|
||||
return await _dbContext.Users
|
||||
.Include(u => u.PostalAddress)
|
||||
.Include(u => u.AccountBalance)
|
||||
.FirstAsync(u => u.Id == uid);
|
||||
}
|
||||
|
||||
[HttpGet("myhost")]
|
||||
public IActionResult MyHost ()
|
||||
{
|
||||
return Ok(new { host = Request.ForwardedFor() });
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates the avatar
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("~/api/setavatar")]
|
||||
public async Task<IActionResult> SetAvatar()
|
||||
{
|
||||
var root = User.InitPostToFileSystem(null);
|
||||
var user = await GetUserData(User.GetUserId());
|
||||
if (Request.Form.Files.Count!=1)
|
||||
return new BadRequestResult();
|
||||
var info = user.ReceiveAvatar(Request.Form.Files[0]);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return Ok(info);
|
||||
}
|
||||
|
||||
[HttpGet("identity")]
|
||||
public async Task<IActionResult> Identity()
|
||||
{
|
||||
return Json(User.Claims.Select(c=>new {c.Type, c.Value}));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json"),Authorize(Roles="Administrator")]
|
||||
[Produces("application/json"),Authorize("AdministratorOnly")]
|
||||
[Route("api/users")]
|
||||
public class ApplicationUserApiController : Controller
|
||||
{
|
||||
@ -23,20 +25,20 @@ namespace Yavsc.Controllers
|
||||
|
||||
// GET: api/ApplicationUserApi
|
||||
[HttpGet]
|
||||
public IEnumerable<UserInfo> GetApplicationUser()
|
||||
public IEnumerable<UserInfo> GetApplicationUser(int skip=0, int take = 25)
|
||||
{
|
||||
return _context.Users.OrderByDescending(u => u.DateModified).Take(25)
|
||||
.Select(u=> new UserInfo {
|
||||
return _context.Users.Skip(skip).Take(take)
|
||||
.Select(u=> new UserInfo{
|
||||
UserId = u.Id,
|
||||
UserName = u.UserName,
|
||||
Avatar = u.Avatar });
|
||||
Avatar = u.Avatar});
|
||||
}
|
||||
|
||||
[HttpGet("search/{pattern}")]
|
||||
public IEnumerable<UserInfo> SearchApplicationUser(string pattern)
|
||||
public IEnumerable<UserInfo> SearchApplicationUser(string pattern, int skip=0, int take = 25)
|
||||
{
|
||||
return _context.Users.Where(u => u.UserName.Contains(pattern))
|
||||
.OrderByDescending(u => u.DateModified).Take(25)
|
||||
.Skip(skip).Take(take)
|
||||
.Select(u=> new UserInfo {
|
||||
UserId = u.Id,
|
||||
UserName = u.UserName,
|
||||
@ -49,14 +51,14 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
ApplicationUser applicationUser = _context.Users.Include(u=>u.Roles).Include(u=>u.Logins).Include(u=>u.Claims).Single(m => m.Id == id);
|
||||
ApplicationUser applicationUser = _context.Users.Single(m => m.Id == id);
|
||||
|
||||
if (applicationUser == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(applicationUser);
|
||||
@ -68,12 +70,12 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
if (id != applicationUser.Id)
|
||||
{
|
||||
return HttpBadRequest();
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(applicationUser).State = EntityState.Modified;
|
||||
@ -86,7 +88,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ApplicationUserExists(id))
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -94,7 +96,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||
return new StatusCodeResult(StatusCodes.Status204NoContent);
|
||||
}
|
||||
|
||||
// POST: api/ApplicationUserApi
|
||||
@ -103,7 +105,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
_context.Users.Add(applicationUser);
|
||||
@ -115,7 +117,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ApplicationUserExists(applicationUser.Id))
|
||||
{
|
||||
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||
return new StatusCodeResult(StatusCodes.Status409Conflict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -132,13 +134,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return HttpBadRequest(ModelState);
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
ApplicationUser applicationUser = _context.Users.Single(m => m.Id == id);
|
||||
if (applicationUser == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Users.Remove(applicationUser);
|
41
src/Api/Controllers/accounting/ProfileApiController.cs
Normal file
41
src/Api/Controllers/accounting/ProfileApiController.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.ApiControllers.accounting
|
||||
{
|
||||
[Route("~/api/profile")]
|
||||
public class ProfileApiController: Controller
|
||||
{
|
||||
readonly UserManager<ApplicationUser> _userManager;
|
||||
readonly ApplicationDbContext _dbContext;
|
||||
public ProfileApiController(ApplicationDbContext dbContext, UserManager<ApplicationUser> userManager)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[HttpGet("{allow}",Name ="setmonthlyemail")]
|
||||
public async Task<object> SetMonthlyEmail(bool allow)
|
||||
{
|
||||
var user = await _userManager.FindByIdAsync(User.GetUserId());
|
||||
user.AllowMonthlyEmail = allow;
|
||||
_dbContext.SaveChanges(User.GetUserId());
|
||||
return Ok(new { monthlyEmailPrefSaved = allow });
|
||||
}
|
||||
|
||||
[HttpGet("userhint/{name}")]
|
||||
public UserInfo[] GetUserHint(string name)
|
||||
{
|
||||
return _dbContext.Users.Where(u=>u.UserName.IndexOf(name)>0)
|
||||
.Select(u=>new UserInfo(u.Id, u.UserName, u.Email, u.Avatar))
|
||||
.Take(10).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
28
src/Api/Helpers/RequestHelpers.cs
Normal file
28
src/Api/Helpers/RequestHelpers.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.ViewModels;
|
||||
using Yavsc.Models;
|
||||
using System.Linq;
|
||||
|
||||
namespace Yavsc.Api.Helpers
|
||||
{
|
||||
public static class RequestHelpers
|
||||
{
|
||||
// Check for some apache proxy header, if any
|
||||
public static string? ForwardedFor(this HttpRequest request) {
|
||||
string? host = request.Headers["X-Forwarded-For"];
|
||||
if (string.IsNullOrEmpty(host)) {
|
||||
host = request.Host.Value;
|
||||
} else { // Using X-Forwarded-For last address
|
||||
host = host.Split(',')
|
||||
.Last()
|
||||
.Trim();
|
||||
}
|
||||
return host;
|
||||
}
|
||||
}
|
||||
}
|
105
src/Api/Program.cs
Normal file
105
src/Api/Program.cs
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright (c) 2024 HigginsSoft, Alexander Higgins - https://github.com/alexhiggins732/
|
||||
|
||||
Copyright (c) 2018, Brock Allen & Dominick Baier. All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
Source code and license this software can be found
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
*/
|
||||
|
||||
using IdentityModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Yavsc;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Interface;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static async Task Main(string[] args)
|
||||
{
|
||||
Console.Title = "API";
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var services = builder.Services;
|
||||
// builder.Services.AddDistributedMemoryCache();
|
||||
|
||||
// accepts any access token issued by identity server
|
||||
// adds an authorization policy for scope 'scope1'
|
||||
|
||||
services
|
||||
.AddAuthorization(options =>
|
||||
{
|
||||
options.AddPolicy("ApiScope", policy =>
|
||||
{
|
||||
policy
|
||||
.RequireAuthenticatedUser()
|
||||
.RequireClaim(JwtClaimTypes.Scope, new string[] { "scope2" });
|
||||
});
|
||||
})
|
||||
.AddCors(options =>
|
||||
{
|
||||
// this defines a CORS policy called "default"
|
||||
options.AddPolicy("default", policy =>
|
||||
{
|
||||
policy.WithOrigins("https://localhost:5003")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
})
|
||||
.AddControllers();
|
||||
|
||||
// accepts any access token issued by identity server
|
||||
var authenticationBuilder = services.AddAuthentication("Bearer")
|
||||
.AddJwtBearer("Bearer", options =>
|
||||
{
|
||||
options.IncludeErrorDetails = true;
|
||||
options.Authority = "https://localhost:5001";
|
||||
options.TokenValidationParameters =
|
||||
new() { ValidateAudience = false, RoleClaimType = Constants.RoleClaimType };
|
||||
options.MapInboundClaims = true;
|
||||
});
|
||||
|
||||
services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||||
|
||||
services.AddTransient<ITrueEmailSender, MailSender>()
|
||||
.AddTransient<IBillingService, BillingService>()
|
||||
.AddTransient<ICalendarManager, CalendarManager>();
|
||||
services.AddTransient<IFileSystemAuthManager, FileSystemAuthManager>();
|
||||
|
||||
WorkflowHelpers.ConfigureBillingService();
|
||||
using (var app = builder.Build())
|
||||
{
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
app
|
||||
.UseRouting()
|
||||
.UseAuthentication()
|
||||
.UseAuthorization()
|
||||
.UseCors("default")
|
||||
/* .UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapDefaultControllerRoute()
|
||||
.RequireAuthorization();
|
||||
})*/
|
||||
|
||||
;
|
||||
// app.MapIdentityApi<ApplicationUser>().RequireAuthorization("ApiScope");
|
||||
app.MapDefaultControllerRoute();
|
||||
app.MapGet("/identity", (HttpContext context) =>
|
||||
new JsonResult(context?.User?.Claims.Select(c => new { c.Type, c.Value }))
|
||||
);
|
||||
|
||||
// app.UseSession();
|
||||
await app.RunAsync();
|
||||
}
|
||||
}
|
||||
}
|
30
src/Api/Properties/launchSettings.json
Normal file
30
src/Api/Properties/launchSettings.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:5001",
|
||||
"sslPort": 6001
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "https://localhost:6001;",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
src/Api/appsettings.json
Normal file
10
src/Api/appsettings.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
1
src/Api/tempkey.jwk
Normal file
1
src/Api/tempkey.jwk
Normal file
@ -0,0 +1 @@
|
||||
{"AdditionalData":{},"Alg":"RS256","Crv":null,"D":"V1qxZgyKyWNi8FbeueGjfOae22fnDa0dU8YpTohrjn89bk9B8kvIzFJP9IPYThTLMaKCTFN09A3aVy_zhL5Cv2ebEqkZIpXkPmtvRavAYxoSQWUfN2czMok216KI7csVVk79csLnnO6i3pf0B9OgGwsuEsLR40_X4MTy5iTejZfwEVobN7H6_uylw5dEUjcJlR-RtuXAZz48stOLt8-y9it7rvowv8eHEsAFSaiV-g92rKZdvMdxVqW5dvHkqF4-h1gdp9VvStZYsqfnR8hrObSxom5yWFnpmxZKmaFaFxbF-k9T8YX1izuPzESPyKCUb-GX5_4sLB6vOiUO4drHiQ","DP":"7Vz77Jz00YuT87QDAEHuBl-GInvI2VT1Fg0HsUEUhBN_o1ZwqlgX6U_3yGUgYYvoWQZZQeLTxRiQSzymPxXiikKnmGt97zMypIllEOar284Ddypa4fraXSJwgKR-1UPYGZg1adjN3KDruLok3ahyUcD9375tCXmQ3Cs0QC1_ATs","DQ":"B5qgaCcQGleo-zZqWIjMCtyEyB4JBbPFtKk3uZ5KAV8lO-TQPJkohraRxInOUHoSS1O2hj1bUO1r-C29XJqrkhi2APGs2hu6V11cmAtwwhj5XPTnL_TNx314dK5ECEQ231gxidfod-6PknG20Qim7sacsj5OrJHfp9RnMZ2p4fk","E":"AQAB","K":null,"KeyId":"E7139A7A77AEA502B0482C026DCE5C59","KeyOps":[],"Kid":"E7139A7A77AEA502B0482C026DCE5C59","Kty":"RSA","N":"tL1q9Mon5IGTGYvBg_FmDoxy0HWQ0ceo6iZmDMzAkjYZ06KKdWoR7Up2ZJ7NrBnGpyrb1uR9qAJAAJm19SLKDKSrEUn5QcnTDMqVQLBurtXYw-eY2DL4cO0bbetc5_z8hyKUzikf6jJRRGfDSR2nEfXwUf3riYfYXtNgSmr_CsBwPUcH12JGad0bwsqJy7z9Tg2_pWvNR36Ba5qd_6VmkLQRGQuDTcHzwbagd3bl4Ma1bzxPULBiBENfj6srAxV-6gQhCJr3mIr1ZsJcZsrYuUnnBNgzYCZvkOkmyB68PlrV9C9xQO8aQfla2s42Uc12-UhBbreI0uBP_k8PXXXjXw","Oth":[],"P":"_jaZkNClDqxS8nddu2t6pgP596qJdzMAq11JVWAoDJV_9JRUZH2Qbq2CrDRUjRF9nxR2bVTglfzZ-bho-Iy9PqcWeVekLObiyR30zmUzoWCdUhmi-BRd3FF3uSteNPc7ohtuX4SrbbCoUR4BpcBAgHas8KKj80sIPpoYo10xK-s","Q":"tgKedcJQilsxEzRRbs8_XD4MxnsmrxqvccfvzzHkqqZMNI0CMGA41ddHiWdNcYsyzqIc-vCf6OGabD6Z7mzZXPbYsr1o4rIQXveUy3Ty3fD9YCRKgWbS9gTbXNGBFAglu3iyNl1XUCGc_DF8PImgk99pu9byPoIr6rAPhciaDV0","QI":"2wtLbwL9kODL6HoF5R8CFmf0Fz3gqoEetrq_I7wuK1pL2vmpZlzmURjvERhi5T6lD2L8SC1vY4AJ7NGzAncwn5ozpnos2s0YIxHYUixj5RuTWQLPKqk5r1bEORuju8KwfW6Nzc4K6Rhk3Lb3TXDvKi6BSf1URjLtiI8DUB_enxw","Use":null,"X":null,"X5c":[],"X5t":null,"X5tS256":null,"X5u":null,"Y":null,"KeySize":2048,"HasPrivateKey":true,"CryptoProviderFactory":{"CryptoProviderCache":{},"CustomCryptoProvider":null,"CacheSignatureProviders":true,"SignatureProviderObjectPoolCacheSize":16}}
|
5
src/Directory.Build.props
Normal file
5
src/Directory.Build.props
Normal file
@ -0,0 +1,5 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.0.8</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,196 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GoogleTranslateNET.Misc;
|
||||
using GoogleTranslateNET.Objects.Error;
|
||||
using GoogleTranslateNET.Objects.LanguageDetection;
|
||||
using GoogleTranslateNET.Objects.SupportedLanguages;
|
||||
using GoogleTranslateNET.Objects.Translation;
|
||||
using RestSharp;
|
||||
using RestSharp.Deserializers;
|
||||
using System.Linq;
|
||||
|
||||
namespace GoogleTranslateNET
|
||||
{
|
||||
public class GoogleTranslate
|
||||
{
|
||||
private string _key;
|
||||
private static RestClient _client = new RestClient("https://www.googleapis.com/language/translate/v2");
|
||||
|
||||
public GoogleTranslate(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
throw new ArgumentException("Key is required.", "key");
|
||||
|
||||
_key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When true, the output from google is in human readable format.
|
||||
/// Default: Not set, Google defaults to true
|
||||
/// </summary>
|
||||
public bool? PrettyPrint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When true, queries will be sent using HTTP POST instead of GET.
|
||||
/// GET queries have a limit of 2000 characters, POST queries have a limit of 5000 characters.
|
||||
/// Default: Not set, Google defaults to false
|
||||
/// </summary>
|
||||
public bool? LargeQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Translates a text from one language to another.
|
||||
/// You can input multiple texts and get them translated all at once.
|
||||
/// Warning: Setting source and destination languages to the same language will result in an error.
|
||||
/// </summary>
|
||||
/// <param name="sourceLanguage">The language to translate from. Set it to Language.Automatic to let Google Translate determine the language.</param>
|
||||
/// <param name="destinationLanaguage">The language to translate to.</param>
|
||||
/// <param name="text">The text to translate. You may input more than one text.</param>
|
||||
/// <returns>The translated text.</returns>
|
||||
public List<Translation> Translate(Language sourceLanguage, Language destinationLanaguage, params string[] text)
|
||||
{
|
||||
//https://www.googleapis.com/language/translate/v2?key=key&q=hello%20world&source=en&target=de
|
||||
RestRequest request = CreateRequest(string.Empty);
|
||||
|
||||
CheckRequest(text);
|
||||
|
||||
//Required
|
||||
foreach (string q in text)
|
||||
{
|
||||
request.AddParameter("q", q);
|
||||
}
|
||||
request.AddParameter("target", destinationLanaguage.GetStringValue());
|
||||
|
||||
//Optional
|
||||
if (sourceLanguage != Language.Automatic)
|
||||
request.AddParameter("source", sourceLanguage.GetStringValue());
|
||||
|
||||
//Output
|
||||
TranslateResult results = GetResponse<TranslateResult>(request);
|
||||
return results.Data.Translations;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives you a list of supported languages.
|
||||
/// </summary>
|
||||
/// <param name="targetLanguage">When defined, gives you a list of languages that translates into the target language.</param>
|
||||
/// <returns>A list of supported languages</returns>
|
||||
public List<TranslationLanaguage> GetSupportedLanguages(Language targetLanguage = Language.Unknown)
|
||||
{
|
||||
//https://www.googleapis.com/language/translate/v2/languages?key=key&target=zh-TW
|
||||
RestRequest request = CreateRequest("languages");
|
||||
|
||||
//Optional
|
||||
if (targetLanguage != Language.Unknown)
|
||||
request.AddParameter("target", targetLanguage.GetStringValue());
|
||||
|
||||
//Output
|
||||
SupportedLanguageResult results = GetResponse<SupportedLanguageResult>(request);
|
||||
return results.Data.Languages;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detects the languages that might be used in the text.
|
||||
/// You can send more than one text in a single request to detect multiple texts.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to use when detecting languages.</param>
|
||||
/// <returns>A list of languages that might be used in the text.</returns>
|
||||
public List<LanguageDetection> DetectLanguage(params string[] text)
|
||||
{
|
||||
//https://www.googleapis.com/language/translate/v2/detect?key=key&q=google+translate+is+fast
|
||||
RestRequest request = CreateRequest("detect");
|
||||
|
||||
CheckRequest(text);
|
||||
|
||||
//Required
|
||||
foreach (string q in text)
|
||||
{
|
||||
request.AddParameter("q", q);
|
||||
}
|
||||
|
||||
//Output
|
||||
LanguageDetectionResult results = GetResponse<LanguageDetectionResult>(request);
|
||||
|
||||
//Flatten the results from Google Translate API
|
||||
List<LanguageDetection> detections = new List<LanguageDetection>();
|
||||
foreach (List<LanguageDetection> languageDetections in results.Data.Detections)
|
||||
{
|
||||
detections.AddRange(languageDetections);
|
||||
}
|
||||
|
||||
return detections;
|
||||
}
|
||||
|
||||
private void CheckRequest(IEnumerable<string> requestContent)
|
||||
{
|
||||
//Compute the total size of the content
|
||||
int sum = requestContent.Sum(item => item.Length);
|
||||
|
||||
if (((LargeQuery.HasValue && !LargeQuery.Value) || !LargeQuery.HasValue) && sum >= 2000)
|
||||
{
|
||||
throw new ArgumentException("Your text content is larger than 2000 characters. Set LargeQuery to 'true' to enable support up to 5000 characters.");
|
||||
}
|
||||
|
||||
if (sum > 5000)
|
||||
throw new ArgumentException("Your text content is larger than 5000 characters. Google Translate only allow up to 5000 characters");
|
||||
}
|
||||
|
||||
private RestRequest CreateRequest(string function)
|
||||
{
|
||||
RestRequest request;
|
||||
|
||||
if (LargeQuery.HasValue && LargeQuery.Value)
|
||||
{
|
||||
request = new RestRequest(function, Method.POST);
|
||||
|
||||
//To use POST, you must use the X-HTTP-Method-Override header to tell the Translate API to treat the request as a GET (use X-HTTP-Method-Override: GET).
|
||||
request.AddHeader("X-HTTP-Method-Override", "GET");
|
||||
}
|
||||
else
|
||||
{
|
||||
request = new RestRequest(function, Method.GET);
|
||||
}
|
||||
|
||||
request.AddParameter("key", _key);
|
||||
|
||||
if (PrettyPrint.HasValue)
|
||||
request.AddParameter("prettyprint", PrettyPrint.ToString().ToLower());
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private T GetResponse<T>(RestRequest request)
|
||||
{
|
||||
RestResponse response = (RestResponse)_client.Execute(request);
|
||||
JsonDeserializer deserializer = new JsonDeserializer();
|
||||
T results = deserializer.Deserialize<T>(response);
|
||||
|
||||
//Try to deserialize it as an error - it is a hack since I'm using generics here.
|
||||
ErrorResponse errorResponse = deserializer.Deserialize<ErrorResponse>(response);
|
||||
|
||||
if (errorResponse.Error != null)
|
||||
throw new Exception(GetErrorText(errorResponse.Error));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private string GetErrorText(Error error)
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(error.Message);
|
||||
|
||||
if (error.Errors.Count >= 1)
|
||||
{
|
||||
ErrorData errorData = error.Errors.First();
|
||||
sb.Append("Reason: " + errorData.Reason);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
return "There was an error. Unable to determine the cause.";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
using GoogleTranslateNET.Misc;
|
||||
|
||||
namespace GoogleTranslateNET
|
||||
{
|
||||
public enum Language
|
||||
{
|
||||
Unknown,
|
||||
Automatic,
|
||||
[StringValue("af")]
|
||||
Afrikaans,
|
||||
[StringValue("sq")]
|
||||
Albanian,
|
||||
[StringValue("ar")]
|
||||
Arabic,
|
||||
[StringValue("be")]
|
||||
Belarusian,
|
||||
[StringValue("bg")]
|
||||
Bulgarian,
|
||||
[StringValue("ca")]
|
||||
Catalan,
|
||||
[StringValue("zh")]
|
||||
ChineseSimplified,
|
||||
[StringValue("zh-TW")]
|
||||
ChineseTraditional,
|
||||
[StringValue("hr")]
|
||||
Croatian,
|
||||
[StringValue("cs")]
|
||||
Czech,
|
||||
[StringValue("da")]
|
||||
Danish,
|
||||
[StringValue("nl")]
|
||||
Dutch,
|
||||
[StringValue("en")]
|
||||
English,
|
||||
[StringValue("eo")]
|
||||
Esperanto,
|
||||
[StringValue("et")]
|
||||
Estonian,
|
||||
[StringValue("tl")]
|
||||
Filipino,
|
||||
[StringValue("fi")]
|
||||
Finnish,
|
||||
[StringValue("fr")]
|
||||
French,
|
||||
[StringValue("gl")]
|
||||
Galician,
|
||||
[StringValue("de")]
|
||||
German,
|
||||
[StringValue("el")]
|
||||
Greek,
|
||||
[StringValue("ht")]
|
||||
HaitianCreole,
|
||||
[StringValue("iw")]
|
||||
Hebrew,
|
||||
[StringValue("hi")]
|
||||
Hindi,
|
||||
[StringValue("hu")]
|
||||
Hungarian,
|
||||
[StringValue("is")]
|
||||
Icelandic,
|
||||
[StringValue("id")]
|
||||
Indonesian,
|
||||
[StringValue("ga")]
|
||||
Irish,
|
||||
[StringValue("it")]
|
||||
Italian,
|
||||
[StringValue("ja")]
|
||||
Japanese,
|
||||
[StringValue("ko")]
|
||||
Korean,
|
||||
[StringValue("lv")]
|
||||
Latvian,
|
||||
[StringValue("lt")]
|
||||
Lithuanian,
|
||||
[StringValue("mk")]
|
||||
Macedonian,
|
||||
[StringValue("ms")]
|
||||
Malay,
|
||||
[StringValue("mt")]
|
||||
Maltese,
|
||||
[StringValue("no")]
|
||||
Norwegian,
|
||||
[StringValue("fa")]
|
||||
Persian,
|
||||
[StringValue("pl")]
|
||||
Polish,
|
||||
[StringValue("pt")]
|
||||
Portuguese,
|
||||
[StringValue("ro")]
|
||||
Romanian,
|
||||
[StringValue("ru")]
|
||||
Russian,
|
||||
[StringValue("sr")]
|
||||
Serbian,
|
||||
[StringValue("sk")]
|
||||
Slovak,
|
||||
[StringValue("sl")]
|
||||
Slovenian,
|
||||
[StringValue("es")]
|
||||
Spanish,
|
||||
[StringValue("sw")]
|
||||
Swahili,
|
||||
[StringValue("sv")]
|
||||
Swedish,
|
||||
[StringValue("th")]
|
||||
Thai,
|
||||
[StringValue("tr")]
|
||||
Turkish,
|
||||
[StringValue("uk")]
|
||||
Ukrainian,
|
||||
[StringValue("vi")]
|
||||
Vietnamese,
|
||||
[StringValue("cy")]
|
||||
Welsh,
|
||||
[StringValue("yi")]
|
||||
Yiddish
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace GoogleTranslateNET.Misc
|
||||
{
|
||||
public static class ExtensionMethods
|
||||
{
|
||||
/// <summary>
|
||||
/// Will get the string value for a given enums value, this will
|
||||
/// only work if you assign the StringValue attribute to
|
||||
/// the items in your enum.
|
||||
/// Source: http://weblogs.asp.net/stefansedich/archive/2008/03/12/enum-with-string-values-in-c.aspx
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetStringValue(this Enum value)
|
||||
{
|
||||
// Get the type
|
||||
Type type = value.GetType();
|
||||
|
||||
// Get fieldinfo for this type
|
||||
FieldInfo fieldInfo = type.GetField(value.ToString());
|
||||
|
||||
// Get the stringvalue attributes
|
||||
StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(
|
||||
typeof(StringValueAttribute), false) as StringValueAttribute[];
|
||||
|
||||
// Return the first if there was a match.
|
||||
return attribs.Length > 0 ? attribs[0].StringValue : null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GoogleTranslateNET.Misc
|
||||
{
|
||||
/// <summary>
|
||||
/// This attribute is used to represent a string value
|
||||
/// for a value in an enum.
|
||||
/// </summary>
|
||||
public class StringValueAttribute : Attribute
|
||||
{
|
||||
public string StringValue { get; private set; }
|
||||
|
||||
public StringValueAttribute(string value)
|
||||
{
|
||||
StringValue = value;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GoogleTranslateNET.Objects.Error
|
||||
{
|
||||
public class Error
|
||||
{
|
||||
public int Code { get; set; }
|
||||
public string Message { get; set; }
|
||||
public List<ErrorData> Errors { get; set; }
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.Error
|
||||
{
|
||||
public class ErrorData
|
||||
{
|
||||
public string Domain { get; set; }
|
||||
public string Reason { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string LocationType { get; set; }
|
||||
public string Location { get; set; }
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.Error
|
||||
{
|
||||
public class ErrorResponse
|
||||
{
|
||||
public Error Error { get; set; }
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.LanguageDetection
|
||||
{
|
||||
public class LanguageDetection
|
||||
{
|
||||
public string Language { get; set; }
|
||||
public bool IsReliable { get; set; }
|
||||
public float Confidence { get; set; }
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GoogleTranslateNET.Objects.LanguageDetection
|
||||
{
|
||||
public class LanguageDetectionData
|
||||
{
|
||||
public List<List<LanguageDetection>> Detections { get; set; }
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.LanguageDetection
|
||||
{
|
||||
public class LanguageDetectionResult
|
||||
{
|
||||
public LanguageDetectionData Data { get; set; }
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GoogleTranslateNET.Objects.SupportedLanguages
|
||||
{
|
||||
public class SupportedLanguageData
|
||||
{
|
||||
public List<TranslationLanaguage> Languages { get; set; }
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.SupportedLanguages
|
||||
{
|
||||
public class SupportedLanguageResult
|
||||
{
|
||||
public SupportedLanguageData Data { get; set; }
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.SupportedLanguages
|
||||
{
|
||||
public class TranslationLanaguage
|
||||
{
|
||||
public string Language { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.Translation
|
||||
{
|
||||
public class TranslateResult
|
||||
{
|
||||
public TranslationData Data { get; set; }
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace GoogleTranslateNET.Objects.Translation
|
||||
{
|
||||
public class Translation
|
||||
{
|
||||
public string TranslatedText { get; set; }
|
||||
public string DetectedSourceLanguage { get; set; }
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user