Compare commits

..

No commits in common. "2af21fb2a7040163a2af2040228621f2eb8039c0" and "3d404e504f4f36522b3b1a030bfee4386112ca3d" have entirely different histories.

7 changed files with 30 additions and 45 deletions

View File

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

View File

@ -5,11 +5,11 @@
# 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. # 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 https://www.gnu.org/licenses/. # You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
from bottle import Bottle, route, request, response from bottle import Bottle, route
from config import directory from config import directory
import templates.plain.main as template_public import templates.plain.main as template_public
import modules.public.home as public_home import modules.public.home as public_home
import modules.api.gebox.package as api_gebox_package import modules.api.gebox.package as api_gebox_package
import modules.api.gebox.version as api_gebox_version import modules.api.gebox.version as api_gebox_version

View File

@ -128,7 +128,7 @@ class instance:
row = self.cursor.fetchone() row = self.cursor.fetchone()
loggorilla.prcss(APIADDR, "Set Response") loggorilla.prcss(APIADDR, "Set Response")
response["status" ] = "success" response["status" ] = "success"
response["desc" ] = "data removed" response["desc" ] = "data edited"
except Exception as e: except Exception as e:
self.cursor.execute("ROLLBACK;") self.cursor.execute("ROLLBACK;")
loggorilla.error(APIADDR, str(e) ) loggorilla.error(APIADDR, str(e) )

View File

@ -124,7 +124,7 @@ class package:
row = self.cursor.fetchone() row = self.cursor.fetchone()
loggorilla.prcss(APIADDR, "Set Response") loggorilla.prcss(APIADDR, "Set Response")
response["status" ] = "success" response["status" ] = "success"
response["desc" ] = "data removed" response["desc" ] = "data edited"
except Exception as e: except Exception as e:
self.cursor.execute("ROLLBACK;") self.cursor.execute("ROLLBACK;")
loggorilla.error(APIADDR, str(e) ) loggorilla.error(APIADDR, str(e) )

View File

@ -41,11 +41,9 @@ 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 `id`, `package`, `version`, DATE_FORMAT(`release`, '%Y-%m-%d %H:%i:%S') AS `release` from gebox_package_version where `package` = %s;", (package,) ) self.cursor.execute("select * from gebox_package_version;")
ls = self.cursor.fetchall() ls = self.cursor.fetchall()
loggorilla.prcss(APIADDR, "Set Response") loggorilla.prcss(APIADDR, "Set Response")
response["status" ] = "success" response["status" ] = "success"
@ -70,7 +68,7 @@ class version:
key = params["key" ] key = params["key" ]
self.cursor.execute("BEGIN;") self.cursor.execute("BEGIN;")
try: try:
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,) ) self.cursor.execute("select * 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"
@ -128,7 +126,7 @@ class version:
row = self.cursor.fetchone() row = self.cursor.fetchone()
loggorilla.prcss(APIADDR, "Set Response") loggorilla.prcss(APIADDR, "Set Response")
response["status" ] = "success" response["status" ] = "success"
response["desc" ] = "data removed" response["desc" ] = "data edited"
except Exception as e: except Exception as e:
self.cursor.execute("ROLLBACK;") self.cursor.execute("ROLLBACK;")
loggorilla.error(APIADDR, str(e) ) loggorilla.error(APIADDR, str(e) )

View File

@ -1,13 +0,0 @@
import datetime
def prcss(loc, msg):
print(f"[loggorilla][{datetime.datetime.now()}][\033[32mprcss\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
def accss(loc, msg):
print(f"[loggorilla][{datetime.datetime.now()}][\033[36maccss\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
def fyinf(loc, msg):
print(f"[loggorilla][{datetime.datetime.now()}][\033[93mfyinf\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
def error(loc, msg):
print(f"[loggorilla][{datetime.datetime.now()}][\033[31merror\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)

View File

@ -8,26 +8,6 @@
-- Prefix v_ = Variable(s) -- Prefix v_ = Variable(s)
-- Prefix o_ = Output(s) -- Prefix o_ = Output(s)
-- Main table
create table if not exists `gebox_package` (
`id` int(11) not null auto_increment primary key,
`name` varchar(36) not null,
`desc` longtext default null
) engine=InnoDB default charset=utf8mb4;
create table if not exists `gebox_package_version` (
`id` int(11) not null auto_increment primary key,
`package` int(11) not null,
`version` longtext not null,
`release` datetime default null,
key `idx_package` (`package`),
constraint `gebox_instance_fk_package`
foreign key (`package`) references `gebox_package` (`id`)
on update cascade
on delete cascade
) engine=InnoDB default charset=utf8mb4;
-- Instance table -- Instance table
create table if not exists `gebox_instance` ( create table if not exists `gebox_instance` (
@ -48,3 +28,23 @@ create table if not exists `gebox_instance` (
on update restrict on update restrict
on delete restrict on delete restrict
) engine=InnoDB default charset=utf8mb4; ) engine=InnoDB default charset=utf8mb4;
-- Main table
create table if not exists `gebox_package` (
`id` int(11) not null auto_increment primary key,
`name` varchar(36) not null,
`desc` longtext default null
) engine=InnoDB default charset=utf8mb4;
create table if not exists `gebox_package_version` (
`id` int(11) not null auto_increment primary key,
`package` int(11) not null,
`version` longtext not null,
`release` datetime default null,
key `idx_package` (`package`),
constraint `gebox_instance_fk_package`
foreign key (`package`) references `gebox_package` (`id`)
on update cascade
on delete cascade
) engine=InnoDB default charset=utf8mb4;