mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 13:40:44 +00:00
Re-enabling sample project, now that it can use h2 database (so it can run & pass in CI); cleanup some warnings, and some initial IJ configs
This commit is contained in:
@ -40,6 +40,8 @@ public class SampleJavalinServer
|
||||
|
||||
private QInstance qInstance;
|
||||
|
||||
private Javalin javalinService;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -62,13 +64,13 @@ public class SampleJavalinServer
|
||||
qInstance = SampleMetaDataProvider.defineInstance();
|
||||
|
||||
QJavalinImplementation qJavalinImplementation = new QJavalinImplementation(qInstance);
|
||||
Javalin service = Javalin.create(config ->
|
||||
javalinService = Javalin.create(config ->
|
||||
{
|
||||
// todo - not all!!
|
||||
config.enableCorsForAllOrigins();
|
||||
}).start(PORT);
|
||||
service.routes(qJavalinImplementation.getRoutes());
|
||||
service.after(ctx ->
|
||||
javalinService.routes(qJavalinImplementation.getRoutes());
|
||||
javalinService.after(ctx ->
|
||||
ctx.res.setHeader("Access-Control-Allow-Origin", "http://localhost:3000"));
|
||||
}
|
||||
catch(Exception e)
|
||||
@ -77,4 +79,16 @@ public class SampleJavalinServer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void stopJavalinServer()
|
||||
{
|
||||
if(javalinService != null)
|
||||
{
|
||||
javalinService.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,12 +59,14 @@ import io.github.cdimascio.dotenv.Dotenv;
|
||||
*******************************************************************************/
|
||||
public class SampleMetaDataProvider
|
||||
{
|
||||
public static final String MYSQL_BACKEND_NAME = "mysql";
|
||||
public static boolean USE_MYSQL = false;
|
||||
|
||||
public static final String RDBMS_BACKEND_NAME = "rdbms";
|
||||
public static final String FILESYSTEM_BACKEND_NAME = "filesystem";
|
||||
|
||||
public static final String AUTH0_AUTHENTICATION_MODULE_NAME = "auth0";
|
||||
// public static final String AUTH0_BASE_URL = "https://kingsrook.us.auth0.com/";
|
||||
public static final String AUTH0_BASE_URL = "https://nutrifresh-one-development.us.auth0.com/";
|
||||
public static final String AUTH0_BASE_URL = "https://nutrifresh-one-development.us.auth0.com/";
|
||||
|
||||
public static final String PROCESS_NAME_GREET = "greet";
|
||||
public static final String PROCESS_NAME_GREET_INTERACTIVE = "greetInteractive";
|
||||
@ -88,7 +90,7 @@ public class SampleMetaDataProvider
|
||||
QInstance qInstance = new QInstance();
|
||||
|
||||
qInstance.setAuthentication(defineAuthentication());
|
||||
qInstance.addBackend(defineMysqlBackend());
|
||||
qInstance.addBackend(defineRdbmsBackend());
|
||||
qInstance.addBackend(defineFilesystemBackend());
|
||||
qInstance.addTable(defineTableCarrier());
|
||||
qInstance.addTable(defineTablePerson());
|
||||
@ -119,17 +121,29 @@ public class SampleMetaDataProvider
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static QBackendMetaData defineMysqlBackend()
|
||||
public static RDBMSBackendMetaData defineRdbmsBackend()
|
||||
{
|
||||
Dotenv dotenv = Dotenv.configure().load();
|
||||
return new RDBMSBackendMetaData()
|
||||
.withVendor("mysql")
|
||||
.withHostName("127.0.0.1")
|
||||
.withPort(3306)
|
||||
.withDatabaseName("qqq")
|
||||
.withUsername("root")
|
||||
.withPassword(dotenv.get("RDBMS_PASSWORD"))
|
||||
.withName(MYSQL_BACKEND_NAME);
|
||||
if(USE_MYSQL)
|
||||
{
|
||||
Dotenv dotenv = Dotenv.configure().load();
|
||||
return new RDBMSBackendMetaData()
|
||||
.withName(RDBMS_BACKEND_NAME)
|
||||
.withVendor("mysql")
|
||||
.withHostName("127.0.0.1")
|
||||
.withPort(3306)
|
||||
.withDatabaseName("qqq")
|
||||
.withUsername("root")
|
||||
.withPassword(dotenv.get("RDBMS_PASSWORD"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return (new RDBMSBackendMetaData()
|
||||
.withName(RDBMS_BACKEND_NAME)
|
||||
.withVendor("h2")
|
||||
.withHostName("mem")
|
||||
.withDatabaseName("test_database")
|
||||
.withUsername("sa"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +167,7 @@ public class SampleMetaDataProvider
|
||||
{
|
||||
QTableMetaData table = new QTableMetaData();
|
||||
table.setName("carrier");
|
||||
table.setBackendName(MYSQL_BACKEND_NAME);
|
||||
table.setBackendName(RDBMS_BACKEND_NAME);
|
||||
table.setPrimaryKeyField("id");
|
||||
|
||||
table.addField(new QFieldMetaData("id", QFieldType.INTEGER));
|
||||
@ -182,7 +196,7 @@ public class SampleMetaDataProvider
|
||||
return new QTableMetaData()
|
||||
.withName("person")
|
||||
.withLabel("Person")
|
||||
.withBackendName(MYSQL_BACKEND_NAME)
|
||||
.withBackendName(RDBMS_BACKEND_NAME)
|
||||
.withPrimaryKeyField("id")
|
||||
.withField(new QFieldMetaData("id", QFieldType.INTEGER))
|
||||
.withField(new QFieldMetaData("createDate", QFieldType.DATE_TIME).withBackendName("create_date"))
|
||||
@ -443,7 +457,7 @@ public class SampleMetaDataProvider
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.addField(new QFieldMetaData(ThrowerStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
|
||||
.withField(new QFieldMetaData(ThrowerStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.sampleapp.customizers;
|
||||
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** The fedex invoice files - they're CSV, but they have a handful of values
|
||||
** that we can't read, because they have an extra quote (") character within
|
||||
** a field.
|
||||
**
|
||||
** It always looks like: {"u
|
||||
** This function fixes it by stripping the " out of the middle, to just be: {u
|
||||
*******************************************************************************/
|
||||
public class FedExInvoiceCSVSyntaxFixer implements Function<String, String>
|
||||
{
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public String apply(String s)
|
||||
{
|
||||
return (s.replaceAll("\\{\"u", "{u"));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user