Compare commits

...

4 Commits

Author SHA1 Message Date
3d404e504f Bruno for GeBox 2025-09-17 13:38:08 +07:00
b8e0df9a39 Merge branch 'system/bruno' into system/gebox 2025-09-17 12:47:31 +07:00
a69e0fb49b gebox handler 2025-09-16 20:43:42 +07:00
b66e5aa9cc CostaPy Collection 2025-06-23 20:10:54 +07:00
22 changed files with 498 additions and 5 deletions

View File

@ -0,0 +1,28 @@
meta {
name: Add
type: http
seq: 1
}
post {
url: http://localhost:11000/api/gebox/instance/:alder
body: json
auth: inherit
}
params:path {
alder: add
}
body:json {
{
"instance":"DAP Personal Website",
"domain":"ditaajipratama.net",
"product":1,
"status":"pending"
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,23 @@
meta {
name: Detail
type: http
seq: 3
}
post {
url: http://localhost:11000/api/gebox/instance/:alder
body: json
auth: inherit
}
params:path {
alder: detail
}
body:json {
{"key":1}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,29 @@
meta {
name: Edit
type: http
seq: 4
}
post {
url: http://localhost:11000/api/gebox/instance/:alder
body: json
auth: inherit
}
params:path {
alder: edit
}
body:json {
{
"key":1,
"instance":"DAP Personal Website",
"domain":"ditaajipratama.net",
"product":1,
"status":"pending"
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,23 @@
meta {
name: List
type: http
seq: 2
}
post {
url: http://localhost:11000/api/gebox/instance/:alder
body: json
auth: inherit
}
params:path {
alder: list
}
body:json {
{}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,25 @@
meta {
name: Remove
type: http
seq: 5
}
post {
url: http://localhost:11000/api/gebox/instance/:alder
body: json
auth: inherit
}
params:path {
alder: remove
}
body:json {
{
"key":1
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,8 @@
meta {
name: Instance
seq: 2
}
auth {
mode: inherit
}

View File

@ -0,0 +1,26 @@
meta {
name: Add
type: http
seq: 2
}
post {
url: http://localhost:11000/api/gebox/package/:alder
body: json
auth: inherit
}
params:path {
alder: add
}
body:json {
{
"name":"My Package",
"desc":null
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,23 @@
meta {
name: Detail
type: http
seq: 4
}
post {
url: http://localhost:11000/api/gebox/package/:alder
body: json
auth: inherit
}
params:path {
alder: detail
}
body:json {
{"key":1}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,27 @@
meta {
name: Edit
type: http
seq: 5
}
post {
url: http://localhost:11000/api/gebox/package/:alder
body: json
auth: inherit
}
params:path {
alder: edit
}
body:json {
{
"key":1,
"name":"My Package",
"desc":null
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,23 @@
meta {
name: List
type: http
seq: 3
}
post {
url: http://localhost:11000/api/gebox/package/:alder
body: json
auth: inherit
}
params:path {
alder: list
}
body:json {
{}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,25 @@
meta {
name: Remove
type: http
seq: 6
}
post {
url: http://localhost:11000/api/gebox/package/:alder
body: json
auth: inherit
}
params:path {
alder: remove
}
body:json {
{
"key":1
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,27 @@
meta {
name: Add
type: http
seq: 1
}
post {
url: http://localhost:11000/api/gebox/package/version/:alder
body: json
auth: inherit
}
params:path {
alder: add
}
body:json {
{
"package":1,
"version":"v0.1",
"release":"2020-01-01 00:00:00"
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,23 @@
meta {
name: Detail
type: http
seq: 3
}
post {
url: http://localhost:11000/api/gebox/package/version/:alder
body: json
auth: inherit
}
params:path {
alder: detail
}
body:json {
{"key":1}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,28 @@
meta {
name: Edit
type: http
seq: 4
}
post {
url: http://localhost:11000/api/gebox/package/version/:alder
body: json
auth: inherit
}
params:path {
alder: edit
}
body:json {
{
"key":1,
"package":1,
"version":"v0.1",
"release":"2020-01-01 00:00:00"
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,23 @@
meta {
name: List
type: http
seq: 2
}
post {
url: http://localhost:11000/api/gebox/package/version/:alder
body: json
auth: inherit
}
params:path {
alder: list
}
body:json {
{}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,25 @@
meta {
name: Remove
type: http
seq: 5
}
post {
url: http://localhost:11000/api/gebox/package/version/:alder
body: json
auth: inherit
}
params:path {
alder: remove
}
body:json {
{
"key":1
}
}
settings {
encodeUrl: true
}

View File

@ -0,0 +1,8 @@
meta {
name: Version
seq: 1
}
auth {
mode: inherit
}

View File

@ -0,0 +1,8 @@
meta {
name: Package
seq: 1
}
auth {
mode: inherit
}

8
bruno/GeBox/folder.bru Normal file
View File

@ -0,0 +1,8 @@
meta {
name: GeBox
seq: 1
}
auth {
mode: inherit
}

5
bruno/bruno.json Normal file
View File

@ -0,0 +1,5 @@
{
"version": "1",
"name": "CostaPy",
"type": "collection"
}

View File

@ -11,6 +11,12 @@ from config import directory
import templates.plain.main as template_public
import modules.public.home as public_home
import modules.api.gebox.package as api_gebox_package
import modules.api.gebox.version as api_gebox_version
import modules.api.gebox.instance as api_gebox_instance
import json
app = Bottle()
@app.route('/')
@ -21,3 +27,75 @@ def index():
}
}
return public_home.main().html(params)
@app.route('/api/gebox/package/<alder>', method=['OPTIONS', 'POST'])
def index(alder):
try:
if request.method == 'OPTIONS':
return None
else:
response.content_type = 'application/json'
params = request.json
if alder == 'add':
return json.dumps(api_gebox_package.package().add(params), indent = 2).encode()
elif alder == 'list':
return json.dumps(api_gebox_package.package().list(params), indent = 2).encode()
elif alder == 'detail':
return json.dumps(api_gebox_package.package().detail(params), indent = 2).encode()
elif alder == 'edit':
return json.dumps(api_gebox_package.package().edit(params), indent = 2).encode()
elif alder == 'remove':
return json.dumps(api_gebox_package.package().remove(params), indent = 2).encode()
else:
return json.dumps({}, indent = 2).encode()
except Exception as e:
print(str(e),flush=True)
return json.dumps({}, indent = 2).encode()
@app.route('/api/gebox/package/version/<alder>', method=['OPTIONS', 'POST'])
def index(alder):
try:
if request.method == 'OPTIONS':
return None
else:
response.content_type = 'application/json'
params = request.json
if alder == 'add':
return json.dumps(api_gebox_version.version().add(params), indent = 2).encode()
elif alder == 'list':
return json.dumps(api_gebox_version.version().list(params), indent = 2).encode()
elif alder == 'detail':
return json.dumps(api_gebox_version.version().detail(params), indent = 2).encode()
elif alder == 'edit':
return json.dumps(api_gebox_version.version().edit(params), indent = 2).encode()
elif alder == 'remove':
return json.dumps(api_gebox_version.version().remove(params), indent = 2).encode()
else:
return json.dumps({}, indent = 2).encode()
except Exception as e:
print(str(e),flush=True)
return json.dumps({}, indent = 2).encode()
@app.route('/api/gebox/instance/<alder>', method=['OPTIONS', 'POST'])
def index(alder):
try:
if request.method == 'OPTIONS':
return None
else:
response.content_type = 'application/json'
params = request.json
if alder == 'add':
return json.dumps(api_gebox_instance.instance().add(params), indent = 2).encode()
elif alder == 'list':
return json.dumps(api_gebox_instance.instance().list(params), indent = 2).encode()
elif alder == 'detail':
return json.dumps(api_gebox_instance.instance().detail(params), indent = 2).encode()
elif alder == 'edit':
return json.dumps(api_gebox_instance.instance().edit(params), indent = 2).encode()
elif alder == 'remove':
return json.dumps(api_gebox_instance.instance().remove(params), indent = 2).encode()
else:
return json.dumps({}, indent = 2).encode()
except Exception as e:
print(str(e),flush=True)
return json.dumps({}, indent = 2).encode()

View File

@ -13,7 +13,7 @@ class version:
self.cursor = self.db_main.cursor(dictionary=True)
def add(self, params):
APIADDR = "/api/gebox/version/add"
APIADDR = "/api/gebox/package/version/add"
response = {}
loggorilla.prcss(APIADDR, "Define Models")
package = params["package" ]
@ -39,7 +39,7 @@ class version:
return response
def list(self, params):
APIADDR = "/api/gebox/version/list"
APIADDR = "/api/gebox/package/version/list"
response = {}
self.cursor.execute("BEGIN;")
try:
@ -62,7 +62,7 @@ class version:
return response
def detail(self, params):
APIADDR = "/api/gebox/version/detail"
APIADDR = "/api/gebox/package/version/detail"
response = {}
loggorilla.prcss(APIADDR, "Define Models")
key = params["key" ]
@ -87,7 +87,7 @@ class version:
return response
def edit(self, params):
APIADDR = "/api/gebox/version/edit"
APIADDR = "/api/gebox/package/version/edit"
response = {}
loggorilla.prcss(APIADDR, "Define Models")
key = params["key" ]
@ -115,7 +115,7 @@ class version:
return response
def remove(self, params):
APIADDR = "/api/gebox/version/remove"
APIADDR = "/api/gebox/package/version/remove"
response = {}
loggorilla.prcss(APIADDR, "Define Models")
key = params["key" ]