Fixing json datetime error and add change Listing based on package

This commit is contained in:
Dita Aji Pratama 2025-09-17 14:27:05 +07:00
parent 1a4c24db00
commit 55c2b2b14d
2 changed files with 5 additions and 3 deletions

View File

@ -15,7 +15,7 @@ params:path {
} }
body:json { body:json {
{} {"package":1}
} }
settings { settings {

View File

@ -41,9 +41,11 @@ class version:
def list(self, params): def list(self, params):
APIADDR = "/api/gebox/package/version/list" APIADDR = "/api/gebox/package/version/list"
response = {} response = {}
loggorilla.prcss(APIADDR, "Define Models")
package = params["package" ]
self.cursor.execute("BEGIN;") self.cursor.execute("BEGIN;")
try: try:
self.cursor.execute("select * from gebox_package_version;") self.cursor.execute("select `id`, `package`, `version`, DATE_FORMAT(`release`, '%Y-%m-%d %H:%i:%S') AS `release` from gebox_package_version where `package` = %s;", (package,) )
ls = self.cursor.fetchall() ls = self.cursor.fetchall()
loggorilla.prcss(APIADDR, "Set Response") loggorilla.prcss(APIADDR, "Set Response")
response["status" ] = "success" response["status" ] = "success"
@ -68,7 +70,7 @@ class version:
key = params["key" ] key = params["key" ]
self.cursor.execute("BEGIN;") self.cursor.execute("BEGIN;")
try: try:
self.cursor.execute("select * from gebox_package_version where `id` = %s ;", (key,) ) self.cursor.execute("select `id`, `package`, `version`, DATE_FORMAT(`release`, '%Y-%m-%d %H:%i:%S') AS `release` from gebox_package_version where `id` = %s ;", (key,) )
row = self.cursor.fetchone() row = self.cursor.fetchone()
loggorilla.prcss(APIADDR, "Set Response") loggorilla.prcss(APIADDR, "Set Response")
response["status" ] = "success" response["status" ] = "success"