Merge pull request #1 from gnieark/structure

Structure
This commit is contained in:
Gnieark 2019-12-02 23:24:17 +01:00 committed by GitHub
commit 5d08af6d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 417 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config/sql.json

0
README.md Normal file
View File

0
classes/README.md Normal file
View File

5
config/sql.json.sample Normal file
View File

@ -0,0 +1,5 @@
{
"dsn": "mysql:dbname=resourcesManager;host=localhost",
"user": "resourcesManager",
"password": "your pass"
}

0
public/doc-api/README.md Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

60
public/doc-api/index.html Normal file
View File

@ -0,0 +1,60 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "resources-manager.yml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
// End Swagger UI call region
window.ui = ui
}
</script>
</body>
</html>

View File

@ -0,0 +1,68 @@
<!doctype html>
<html lang="en-US">
<title>Swagger UI: OAuth2 Redirect</title>
<body onload="run()">
</body>
</html>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
} else {
qp = location.search.substring(1);
}
arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
}
) : {}
isValid = qp.state === sentState
if ((
oauth2.auth.schema.get("flow") === "accessCode"||
oauth2.auth.schema.get("flow") === "authorizationCode"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
</script>

View File

@ -0,0 +1,110 @@
swagger: "2.0"
info:
description: "SimplePAD API"
version: "1.0.0"
title: "SimplePad API"
host: "simplepad.localhost"
basePath: "/api"
tags:
- name: "pad"
description: "CRUD Pads"
schemes:
- "https"
- "http"
paths:
/pad:
post:
tags:
- "pad"
summary: "Create a new pad"
description: "Create a new PAD (with a random id)"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/Pad"
responses:
405:
description: "Invalid input"
200:
description: "SuccessFull"
schema:
$ref: "#/definitions/Pad"
/pad/{pad_id}:
get:
tags:
- "pad"
produces:
- "application/json"
parameters:
- in: "path"
name: "pad_id"
required: true
type: string
maxLength: 6
minLength: 6
responses:
404:
description: "Does not exists"
200:
description: "SuccessFull"
schema:
$ref: "#/definitions/Pad"
post:
tags:
- "pad"
description: "Create a new PAD with the given ID"
produces:
- "application/json"
parameters:
- in: "path"
name: "pad_id"
required: true
type: string
maxLength: 6
minLength: 6
- in: "body"
name: "body"
description: "content"
required: true
schema:
$ref: "#/definitions/PadPost"
responses:
405:
description: "Invalid input"
409:
description: "Given Id already exists"
200:
description: "SuccessFull"
schema:
$ref: "#/definitions/Pad"
definitions:
Pad:
type: "object"
properties:
id:
type: string
maxLength: 6
minLength: 6
content:
type: string
create_date:
type: string
format: date
PadPost:
type: "object"
required:
- content
properties:
content:
type: string

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
public/index.php Normal file
View File