feat(ocme): added in ocme with endpoints base
This commit is contained in:
13
database/migrations/0011_aberrant_nehzno.sql
Normal file
13
database/migrations/0011_aberrant_nehzno.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
CREATE TABLE "ocmeData" (
|
||||
"ocme_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"sscc" text,
|
||||
"runningNr" numeric NOT NULL,
|
||||
"completed" boolean DEFAULT false,
|
||||
"lineNum" numeric NOT NULL,
|
||||
"pickedUp" boolean DEFAULT false,
|
||||
"areaFrom" text NOT NULL,
|
||||
"add_User" text DEFAULT 'LST_System' NOT NULL,
|
||||
"add_Date" timestamp DEFAULT now(),
|
||||
"upd_User" text DEFAULT 'LST_System' NOT NULL,
|
||||
"upd_date" timestamp DEFAULT now()
|
||||
);
|
||||
8
database/migrations/0012_mixed_captain_stacy.sql
Normal file
8
database/migrations/0012_mixed_captain_stacy.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE "logs" (
|
||||
"log_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"level" text,
|
||||
"username" text DEFAULT 'LST_Serivce',
|
||||
"service" text DEFAULT 'system' NOT NULL,
|
||||
"message" text NOT NULL,
|
||||
"add_Date" timestamp DEFAULT now()
|
||||
);
|
||||
633
database/migrations/meta/0011_snapshot.json
Normal file
633
database/migrations/meta/0011_snapshot.json
Normal file
@@ -0,0 +1,633 @@
|
||||
{
|
||||
"id": "e9f4e761-c157-4780-bc41-a91c7b63f5f9",
|
||||
"prevId": "f6cf1c56-3bd4-492c-8324-1800b18f3d03",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
"public.eom": {
|
||||
"name": "eom",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"eomMonth": {
|
||||
"name": "eomMonth",
|
||||
"type": "date",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"article": {
|
||||
"name": "article",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"articleDescription": {
|
||||
"name": "articleDescription",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.modules": {
|
||||
"name": "modules",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"module_id": {
|
||||
"name": "module_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"active": {
|
||||
"name": "active",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": false
|
||||
},
|
||||
"roles": {
|
||||
"name": "roles",
|
||||
"type": "jsonb",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'[\"view\",\"systemAdmin\"]'::jsonb"
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"module_name": {
|
||||
"name": "module_name",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.ocmeData": {
|
||||
"name": "ocmeData",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"ocme_id": {
|
||||
"name": "ocme_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"sscc": {
|
||||
"name": "sscc",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"runningNr": {
|
||||
"name": "runningNr",
|
||||
"type": "numeric",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"completed": {
|
||||
"name": "completed",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": false
|
||||
},
|
||||
"lineNum": {
|
||||
"name": "lineNum",
|
||||
"type": "numeric",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"pickedUp": {
|
||||
"name": "pickedUp",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": false
|
||||
},
|
||||
"areaFrom": {
|
||||
"name": "areaFrom",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.roles": {
|
||||
"name": "roles",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"role_id": {
|
||||
"name": "role_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"role_name": {
|
||||
"name": "role_name",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.settings": {
|
||||
"name": "settings",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"role_id": {
|
||||
"name": "role_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"value": {
|
||||
"name": "value",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"moduleName": {
|
||||
"name": "moduleName",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"roles": {
|
||||
"name": "roles",
|
||||
"type": "jsonb",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'[\"systemAdmin\"]'::jsonb"
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"name": {
|
||||
"name": "name",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.userRoles": {
|
||||
"name": "userRoles",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"role_id": {
|
||||
"name": "role_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"module_id": {
|
||||
"name": "module_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"role": {
|
||||
"name": "role",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"user_module_unique": {
|
||||
"name": "user_module_unique",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "user_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "module_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {
|
||||
"userRoles_user_id_users_user_id_fk": {
|
||||
"name": "userRoles_user_id_users_user_id_fk",
|
||||
"tableFrom": "userRoles",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"user_id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"userRoles_role_id_roles_role_id_fk": {
|
||||
"name": "userRoles_role_id_roles_role_id_fk",
|
||||
"tableFrom": "userRoles",
|
||||
"tableTo": "roles",
|
||||
"columnsFrom": [
|
||||
"role_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"role_id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"userRoles_module_id_modules_module_id_fk": {
|
||||
"name": "userRoles_module_id_modules_module_id_fk",
|
||||
"tableFrom": "userRoles",
|
||||
"tableTo": "modules",
|
||||
"columnsFrom": [
|
||||
"module_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"module_id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.users": {
|
||||
"name": "users",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"password": {
|
||||
"name": "password",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"passwordToken": {
|
||||
"name": "passwordToken",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"passwordTokenExpires": {
|
||||
"name": "passwordTokenExpires",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"active": {
|
||||
"name": "active",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": true
|
||||
},
|
||||
"pingcode": {
|
||||
"name": "pingcode",
|
||||
"type": "numeric",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"role": {
|
||||
"name": "role",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'user'"
|
||||
},
|
||||
"lastLogin": {
|
||||
"name": "lastLogin",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"username": {
|
||||
"name": "username",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "username",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"sequences": {},
|
||||
"roles": {},
|
||||
"policies": {},
|
||||
"views": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
686
database/migrations/meta/0012_snapshot.json
Normal file
686
database/migrations/meta/0012_snapshot.json
Normal file
@@ -0,0 +1,686 @@
|
||||
{
|
||||
"id": "756faedf-1bcb-43eb-b122-93287c80122e",
|
||||
"prevId": "e9f4e761-c157-4780-bc41-a91c7b63f5f9",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
"public.eom": {
|
||||
"name": "eom",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"eomMonth": {
|
||||
"name": "eomMonth",
|
||||
"type": "date",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"article": {
|
||||
"name": "article",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"articleDescription": {
|
||||
"name": "articleDescription",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.logs": {
|
||||
"name": "logs",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"log_id": {
|
||||
"name": "log_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"level": {
|
||||
"name": "level",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "'LST_Serivce'"
|
||||
},
|
||||
"service": {
|
||||
"name": "service",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'system'"
|
||||
},
|
||||
"message": {
|
||||
"name": "message",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.modules": {
|
||||
"name": "modules",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"module_id": {
|
||||
"name": "module_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"active": {
|
||||
"name": "active",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": false
|
||||
},
|
||||
"roles": {
|
||||
"name": "roles",
|
||||
"type": "jsonb",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'[\"view\",\"systemAdmin\"]'::jsonb"
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"module_name": {
|
||||
"name": "module_name",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.ocmeData": {
|
||||
"name": "ocmeData",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"ocme_id": {
|
||||
"name": "ocme_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"sscc": {
|
||||
"name": "sscc",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"runningNr": {
|
||||
"name": "runningNr",
|
||||
"type": "numeric",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"completed": {
|
||||
"name": "completed",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": false
|
||||
},
|
||||
"lineNum": {
|
||||
"name": "lineNum",
|
||||
"type": "numeric",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"pickedUp": {
|
||||
"name": "pickedUp",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": false
|
||||
},
|
||||
"areaFrom": {
|
||||
"name": "areaFrom",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.roles": {
|
||||
"name": "roles",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"role_id": {
|
||||
"name": "role_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"role_name": {
|
||||
"name": "role_name",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.settings": {
|
||||
"name": "settings",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"role_id": {
|
||||
"name": "role_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"value": {
|
||||
"name": "value",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"moduleName": {
|
||||
"name": "moduleName",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"roles": {
|
||||
"name": "roles",
|
||||
"type": "jsonb",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'[\"systemAdmin\"]'::jsonb"
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"name": {
|
||||
"name": "name",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.userRoles": {
|
||||
"name": "userRoles",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"role_id": {
|
||||
"name": "role_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"module_id": {
|
||||
"name": "module_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"role": {
|
||||
"name": "role",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"user_module_unique": {
|
||||
"name": "user_module_unique",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "user_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "module_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {
|
||||
"userRoles_user_id_users_user_id_fk": {
|
||||
"name": "userRoles_user_id_users_user_id_fk",
|
||||
"tableFrom": "userRoles",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"user_id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"userRoles_role_id_roles_role_id_fk": {
|
||||
"name": "userRoles_role_id_roles_role_id_fk",
|
||||
"tableFrom": "userRoles",
|
||||
"tableTo": "roles",
|
||||
"columnsFrom": [
|
||||
"role_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"role_id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"userRoles_module_id_modules_module_id_fk": {
|
||||
"name": "userRoles_module_id_modules_module_id_fk",
|
||||
"tableFrom": "userRoles",
|
||||
"tableTo": "modules",
|
||||
"columnsFrom": [
|
||||
"module_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"module_id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.users": {
|
||||
"name": "users",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"password": {
|
||||
"name": "password",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"passwordToken": {
|
||||
"name": "passwordToken",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"passwordTokenExpires": {
|
||||
"name": "passwordTokenExpires",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"active": {
|
||||
"name": "active",
|
||||
"type": "boolean",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": true
|
||||
},
|
||||
"pingcode": {
|
||||
"name": "pingcode",
|
||||
"type": "numeric",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"role": {
|
||||
"name": "role",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'user'"
|
||||
},
|
||||
"lastLogin": {
|
||||
"name": "lastLogin",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"add_User": {
|
||||
"name": "add_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"add_Date": {
|
||||
"name": "add_Date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
},
|
||||
"upd_User": {
|
||||
"name": "upd_User",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'LST_System'"
|
||||
},
|
||||
"upd_date": {
|
||||
"name": "upd_date",
|
||||
"type": "timestamp",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"username": {
|
||||
"name": "username",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "username",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"sequences": {},
|
||||
"roles": {},
|
||||
"policies": {},
|
||||
"views": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,20 @@
|
||||
"when": 1741289750635,
|
||||
"tag": "0010_modern_loa",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 11,
|
||||
"version": "7",
|
||||
"when": 1741311920806,
|
||||
"tag": "0011_aberrant_nehzno",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 12,
|
||||
"version": "7",
|
||||
"when": 1741366351980,
|
||||
"tag": "0012_mixed_captain_stacy",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
31
database/schema/ocme.ts
Normal file
31
database/schema/ocme.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import {text, pgTable, numeric, index, timestamp, boolean, uuid, uniqueIndex} from "drizzle-orm/pg-core";
|
||||
import {createInsertSchema, createSelectSchema} from "drizzle-zod";
|
||||
import {z} from "zod";
|
||||
|
||||
export const ocmeData = pgTable(
|
||||
"ocmeData",
|
||||
{
|
||||
ocme_id: uuid("ocme_id").defaultRandom().primaryKey(),
|
||||
sscc: text("sscc"),
|
||||
runningNr: numeric("runningNr").notNull(),
|
||||
completed: boolean("completed").default(false),
|
||||
lineNum: numeric("lineNum").notNull(),
|
||||
pickedUp: boolean("pickedUp").default(false),
|
||||
areaFrom: text("areaFrom").notNull(),
|
||||
add_User: text("add_User").default("LST_System").notNull(),
|
||||
add_Date: timestamp("add_Date").defaultNow(),
|
||||
upd_user: text("upd_User").default("LST_System").notNull(),
|
||||
upd_date: timestamp("upd_date").defaultNow(),
|
||||
},
|
||||
(table) => [
|
||||
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
// uniqueIndex("role_name").on(table.name),
|
||||
]
|
||||
);
|
||||
|
||||
// Schema for inserting a user - can be used to validate API requests
|
||||
// export const insertRolesSchema = createInsertSchema(roles, {
|
||||
// name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
|
||||
// });
|
||||
// Schema for selecting a Expenses - can be used to validate API responses
|
||||
export const selectRolesSchema = createSelectSchema(ocmeData);
|
||||
23
server/services/ocme/controller/getInfo.ts
Normal file
23
server/services/ocme/controller/getInfo.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {db} from "../../../../database/dbclient.js";
|
||||
import {ocmeData} from "../../../../database/schema/ocme.js";
|
||||
import {differenceInMinutes} from "date-fns";
|
||||
import {createLog} from "../../logger/logger.js";
|
||||
|
||||
export const getInfo = async () => {
|
||||
let ocmeInfo: any = [];
|
||||
try {
|
||||
ocmeInfo = await db.select().from(ocmeData);
|
||||
|
||||
// add in the time difference
|
||||
ocmeInfo = ocmeInfo.map((o: any) => {
|
||||
const now = new Date(Date.now());
|
||||
const diff = differenceInMinutes(now, o.add_Date!);
|
||||
return {...o, waitingFor: diff};
|
||||
});
|
||||
} catch (error) {
|
||||
createLog("error", "ocme", "ocme", "There was an error trying to retrive the ocmeInfo.");
|
||||
throw Error("There was an error trying to retrive the.");
|
||||
}
|
||||
|
||||
return ocmeInfo;
|
||||
};
|
||||
13
server/services/ocme/controller/postRunningNr.ts
Normal file
13
server/services/ocme/controller/postRunningNr.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const postLabelData = async (data: any) => {
|
||||
// if we have sscc we will do everything here and ignore the rn even it its sent over
|
||||
|
||||
if (data.sscc) {
|
||||
return {success: true, message: "sscc sent over", data: data};
|
||||
}
|
||||
|
||||
if (data.runningNr) {
|
||||
return {success: true, message: "runningNr sent over", data: data};
|
||||
} else {
|
||||
throw Error("Improper data was sent over");
|
||||
}
|
||||
};
|
||||
@@ -1,19 +1,19 @@
|
||||
import type {Context} from "hono";
|
||||
import {OpenAPIHono} from "@hono/zod-openapi";
|
||||
|
||||
export const ocmeService = async (c: Context) => {
|
||||
const url = new URL(c.req.url);
|
||||
// routes
|
||||
import getInfo from "./route/getInfo.js";
|
||||
import postRunningNr from "./route/postRunningNumber.js";
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
const ocmeUrl = `http://localhost:${process.env.OCME_PORT}${url.pathname.replace("/ocme", "")}`;
|
||||
const routes = [getInfo, postRunningNr] as const;
|
||||
|
||||
console.log(ocmeUrl);
|
||||
const ocmeResponse = await fetch(ocmeUrl, {
|
||||
method: c.req.method,
|
||||
headers: c.req.raw.headers,
|
||||
body: c.req.method !== "GET" && c.req.method !== "HEAD" ? await c.req.text() : undefined,
|
||||
});
|
||||
// app.route("/server", modules);
|
||||
const appRoutes = routes.forEach((route) => {
|
||||
app.route("/api/v1", route);
|
||||
});
|
||||
|
||||
return new Response(ocmeResponse.body, {
|
||||
status: ocmeResponse.status,
|
||||
headers: ocmeResponse.headers,
|
||||
});
|
||||
};
|
||||
app.all("/api/v1/*", (c) => {
|
||||
return c.json({success: false, message: "you have encounted an ocme route that dose not exist."});
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
79
server/services/ocme/route/getInfo.ts
Normal file
79
server/services/ocme/route/getInfo.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import {createRoute, OpenAPIHono, z} from "@hono/zod-openapi";
|
||||
import {getInfo} from "../controller/getInfo.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
const AddSetting = z.object({
|
||||
name: z.string().openapi({example: "server"}),
|
||||
value: z.string().openapi({example: "localhost"}),
|
||||
description: z.string().openapi({example: "The server we are going to connect to"}),
|
||||
roles: z.string().openapi({example: "admin"}),
|
||||
module: z.string().openapi({example: "production"}),
|
||||
});
|
||||
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["ocme"],
|
||||
summary: "Get all current info",
|
||||
method: "get",
|
||||
path: "/getinfo",
|
||||
request: {
|
||||
body: {
|
||||
content: {
|
||||
"application/json": {schema: AddSetting},
|
||||
},
|
||||
},
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: z.object({
|
||||
success: z.boolean().openapi({example: true}),
|
||||
message: z.string().openapi({example: "Starter"}),
|
||||
data: z.array(z.object({})).optional().openapi({example: []}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
description: "Response message",
|
||||
},
|
||||
400: {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: z.object({
|
||||
success: z.boolean().openapi({example: false}),
|
||||
message: z.string().optional().openapi({example: "Internal Server error"}),
|
||||
data: z.array(z.object({})).optional().openapi({example: []}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
description: "Internal Server Error",
|
||||
},
|
||||
// 401: {
|
||||
// content: {
|
||||
// "application/json": {
|
||||
// schema: z.object({message: z.string().optional().openapi({example: "Unauthenticated"})}),
|
||||
// },
|
||||
// },
|
||||
// description: "Unauthorized",
|
||||
// },
|
||||
// 500: {
|
||||
// content: {
|
||||
// "application/json": {
|
||||
// schema: z.object({message: z.string().optional().openapi({example: "Internal Server error"})}),
|
||||
// },
|
||||
// },
|
||||
// description: "Internal Server Error",
|
||||
// },
|
||||
},
|
||||
}),
|
||||
async (c) => {
|
||||
// make sure we have a vaid user being accessed thats really logged in
|
||||
try {
|
||||
return c.json({success: true, message: "Ocme Info", data: await getInfo()}, 200);
|
||||
} catch (error) {
|
||||
return c.json({success: false, message: "There was an error getting ocmeInfo data", data: error}, 400);
|
||||
}
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
81
server/services/ocme/route/postRunningNumber.ts
Normal file
81
server/services/ocme/route/postRunningNumber.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import {createRoute, OpenAPIHono, z} from "@hono/zod-openapi";
|
||||
import {getInfo} from "../controller/getInfo.js";
|
||||
import {postLabelData} from "../controller/postRunningNr.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
const PostRunningNr = z.object({
|
||||
sscc: z.string().optional().openapi({example: "00090103830005710997"}),
|
||||
runningNr: z.string().optional().openapi({example: "localhost"}),
|
||||
areaFrom: z.string().optional().openapi({example: "The server we are going to connect to"}),
|
||||
completed: z.boolean().optional().openapi({example: true}),
|
||||
});
|
||||
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["ocme"],
|
||||
summary: "Post New running number to be picked up.",
|
||||
method: "post",
|
||||
path: "/postrunningnumber",
|
||||
request: {
|
||||
body: {
|
||||
content: {
|
||||
"application/json": {schema: PostRunningNr},
|
||||
},
|
||||
},
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: z.object({
|
||||
success: z.boolean().openapi({example: true}),
|
||||
message: z.string().openapi({example: "Starter"}),
|
||||
data: z.array(z.object({})).optional().openapi({example: []}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
description: "Response message",
|
||||
},
|
||||
400: {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: z.object({
|
||||
success: z.boolean().openapi({example: false}),
|
||||
message: z.string().optional().openapi({example: "Internal Server error"}),
|
||||
data: z.array(z.object({})).optional().openapi({example: []}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
description: "Internal Server Error",
|
||||
},
|
||||
// 401: {
|
||||
// content: {
|
||||
// "application/json": {
|
||||
// schema: z.object({message: z.string().optional().openapi({example: "Unauthenticated"})}),
|
||||
// },
|
||||
// },
|
||||
// description: "Unauthorized",
|
||||
// },
|
||||
// 500: {
|
||||
// content: {
|
||||
// "application/json": {
|
||||
// schema: z.object({message: z.string().optional().openapi({example: "Internal Server error"})}),
|
||||
// },
|
||||
// },
|
||||
// description: "Internal Server Error",
|
||||
// },
|
||||
},
|
||||
}),
|
||||
async (c) => {
|
||||
// make sure we have a vaid user being accessed thats really logged in
|
||||
try {
|
||||
const data = await c.req.json();
|
||||
const postPallet = await postLabelData(data);
|
||||
return c.json({success: postPallet.success, message: postPallet.message, data: postPallet.data}, 200);
|
||||
} catch (error) {
|
||||
return c.json({success: false, message: "There was an error getting ocmeInfo data", data: error}, 400);
|
||||
}
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
Reference in New Issue
Block a user