Forced merge: merge ai-dev into master

This commit is contained in:
Flatlogic Bot 2025-10-17 15:01:15 +00:00
commit b34e6de2b1
21 changed files with 277 additions and 37 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
node_modules/
*/node_modules/
**/node_modules/
*/build/
**/build/
.DS_Store
.env

File diff suppressed because one or more lines are too long

18
app-shell/src/config.js Normal file
View File

@ -0,0 +1,18 @@
const config = {
admin_pass: "df170051",
admin_email: "admin@flatlogic.com",
schema_encryption_key: process.env.SCHEMA_ENCRYPTION_KEY || '',
project_uuid: 'df170051-a138-4641-ad0d-a5ac07a19601',
flHost: process.env.NODE_ENV === 'production' ? 'https://flatlogic.com/projects' : 'http://localhost:3000/projects',
gitea_domain: process.env.GITEA_DOMAIN || 'gitea.flatlogic.app',
gitea_username: process.env.GITEA_USERNAME || 'admin',
gitea_api_token: process.env.GITEA_API_TOKEN || null,
github_repo_url: process.env.GITHUB_REPO_URL || null,
github_token: process.env.GITHUB_TOKEN || null,
};
module.exports = config;

54
app-shell/src/index.js Normal file
View File

@ -0,0 +1,54 @@
const express = require('express');
const cors = require('cors');
const app = express();
const bodyParser = require('body-parser');
const checkPermissions = require('./middlewares/check-permissions');
const modifyPath = require('./middlewares/modify-path');
const VCS = require('./services/vcs');
const executorRoutes = require('./routes/executor');
const vcsRoutes = require('./routes/vcs');
// Function to initialize the Git repository
function initRepo() {
const projectId = '34916';
return VCS.initRepo(projectId);
}
// Start the Express app on APP_SHELL_PORT (4000)
function startServer() {
const PORT = 4000;
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}`);
});
}
// Run Git check after the server is up
function runGitCheck() {
initRepo()
.then(result => {
console.log(result?.message ? result.message : result);
// Here you can add additional logic if needed
})
.catch(err => {
console.error('Error during repo initialization:', err);
// Optionally exit the process if Git check is critical:
// process.exit(1);
});
}
app.use(cors({ origin: true }));
app.use(bodyParser.json());
app.use(checkPermissions);
app.use(modifyPath);
app.use('/executor', executorRoutes);
app.use('/vcs', vcsRoutes);
// Start the app_shell server
startServer();
// Now perform Git check
runGitCheck();
module.exports = app;

View File

@ -0,0 +1,54 @@
module.exports = {
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async up(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.addColumn(
'archival_items',
'periodId',
{
type: Sequelize.DataTypes.UUID,
references: {
model: 'periods',
key: 'id',
},
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('archival_items', 'periodId', {
transaction,
});
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -0,0 +1,88 @@
module.exports = {
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async up(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('periods', 'period_from', {
transaction,
});
await queryInterface.removeColumn('periods', 'period_to', {
transaction,
});
await queryInterface.addColumn(
'periods',
'period_from',
{
type: Sequelize.DataTypes.DATEONLY,
},
{ transaction },
);
await queryInterface.addColumn(
'periods',
'period_to',
{
type: Sequelize.DataTypes.DATEONLY,
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('periods', 'period_to', {
transaction,
});
await queryInterface.removeColumn('periods', 'period_from', {
transaction,
});
await queryInterface.addColumn(
'periods',
'period_to',
{
type: Sequelize.DataTypes.DATE,
},
{ transaction },
);
await queryInterface.addColumn(
'periods',
'period_from',
{
type: Sequelize.DataTypes.DATE,
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -19,11 +19,23 @@ module.exports = function (sequelize, DataTypes) {
}, },
period_from: { period_from: {
type: DataTypes.DATE, type: DataTypes.DATEONLY,
get: function () {
return this.getDataValue('period_from')
? moment.utc(this.getDataValue('period_from')).format('YYYY-MM-DD')
: null;
},
}, },
period_to: { period_to: {
type: DataTypes.DATE, type: DataTypes.DATEONLY,
get: function () {
return this.getDataValue('period_to')
? moment.utc(this.getDataValue('period_to')).format('YYYY-MM-DD')
: null;
},
}, },
importHash: { importHash: {

14
cloudbuild.yaml Normal file
View File

@ -0,0 +1,14 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/fldemo-315215/hoboken-34916-dev:latest || exit 0']
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'-t', 'gcr.io/fldemo-315215/hoboken-34916-dev:latest',
'--file', 'Dockerfile.dev',
'--cache-from', 'gcr.io/fldemo-315215/hoboken-34916-dev:latest',
'.'
]
images: ['gcr.io/fldemo-315215/hoboken-34916-dev:latest']
logsBucket: 'gs://fldemo-315215-cloudbuild-logs'

View File

@ -0,0 +1 @@
{}

View File

@ -1,5 +1,6 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
/// <reference path="./build/types/routes.d.ts" />
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information. // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

View File

@ -89,7 +89,7 @@ const CardPeriods = ({
</dt> </dt>
<dd className='flex items-start gap-x-2'> <dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'> <div className='font-medium line-clamp-4'>
{dataFormatter.dateTimeFormatter(item.period_from)} {dataFormatter.dateFormatter(item.period_from)}
</div> </div>
</dd> </dd>
</div> </div>
@ -100,7 +100,7 @@ const CardPeriods = ({
</dt> </dt>
<dd className='flex items-start gap-x-2'> <dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'> <div className='font-medium line-clamp-4'>
{dataFormatter.dateTimeFormatter(item.period_to)} {dataFormatter.dateFormatter(item.period_to)}
</div> </div>
</dd> </dd>
</div> </div>

View File

@ -59,14 +59,14 @@ const ListPeriods = ({
<div className={'flex-1 px-3'}> <div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Period From</p> <p className={'text-xs text-gray-500 '}>Period From</p>
<p className={'line-clamp-2'}> <p className={'line-clamp-2'}>
{dataFormatter.dateTimeFormatter(item.period_from)} {dataFormatter.dateFormatter(item.period_from)}
</p> </p>
</div> </div>
<div className={'flex-1 px-3'}> <div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Period To</p> <p className={'text-xs text-gray-500 '}>Period To</p>
<p className={'line-clamp-2'}> <p className={'line-clamp-2'}>
{dataFormatter.dateTimeFormatter(item.period_to)} {dataFormatter.dateFormatter(item.period_to)}
</p> </p>
</div> </div>
</Link> </Link>

View File

@ -61,7 +61,7 @@ export const loadColumns = async (
editable: hasUpdatePermission, editable: hasUpdatePermission,
type: 'dateTime', type: 'date',
valueGetter: (params: GridValueGetterParams) => valueGetter: (params: GridValueGetterParams) =>
new Date(params.row.period_from), new Date(params.row.period_from),
}, },
@ -77,7 +77,7 @@ export const loadColumns = async (
editable: hasUpdatePermission, editable: hasUpdatePermission,
type: 'dateTime', type: 'date',
valueGetter: (params: GridValueGetterParams) => valueGetter: (params: GridValueGetterParams) =>
new Date(params.row.period_to), new Date(params.row.period_to),
}, },

View File

@ -99,8 +99,7 @@ const EditPeriods = () => {
<FormField label='Period From'> <FormField label='Period From'>
<DatePicker <DatePicker
dateFormat='yyyy-MM-dd hh:mm' dateFormat='yyyy-MM-dd'
showTimeSelect
selected={ selected={
initialValues.period_from initialValues.period_from
? new Date( ? new Date(
@ -118,8 +117,7 @@ const EditPeriods = () => {
<FormField label='Period To'> <FormField label='Period To'>
<DatePicker <DatePicker
dateFormat='yyyy-MM-dd hh:mm' dateFormat='yyyy-MM-dd'
showTimeSelect
selected={ selected={
initialValues.period_to initialValues.period_to
? new Date( ? new Date(

View File

@ -97,8 +97,7 @@ const EditPeriodsPage = () => {
<FormField label='Period From'> <FormField label='Period From'>
<DatePicker <DatePicker
dateFormat='yyyy-MM-dd hh:mm' dateFormat='yyyy-MM-dd'
showTimeSelect
selected={ selected={
initialValues.period_from initialValues.period_from
? new Date( ? new Date(
@ -116,8 +115,7 @@ const EditPeriodsPage = () => {
<FormField label='Period To'> <FormField label='Period To'>
<DatePicker <DatePicker
dateFormat='yyyy-MM-dd hh:mm' dateFormat='yyyy-MM-dd'
showTimeSelect
selected={ selected={
initialValues.period_to initialValues.period_to
? new Date( ? new Date(

View File

@ -28,12 +28,7 @@ const PeriodsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([ const [filters] = useState([{ label: 'Name', title: 'name' }]);
{ label: 'Name', title: 'name' },
{ label: 'Period From', title: 'period_from', date: 'true' },
{ label: 'Period To', title: 'period_to', date: 'true' },
]);
const hasCreatePermission = const hasCreatePermission =
currentUser && hasPermission(currentUser, 'CREATE_PERIODS'); currentUser && hasPermission(currentUser, 'CREATE_PERIODS');

View File

@ -36,8 +36,10 @@ const initialValues = {
name: '', name: '',
period_from: '', period_from: '',
datePeriod_from: '',
period_to: '', period_to: '',
datePeriod_to: '',
}; };
const PeriodsNew = () => { const PeriodsNew = () => {
@ -73,18 +75,14 @@ const PeriodsNew = () => {
<FormField label='Period From'> <FormField label='Period From'>
<Field <Field
type='datetime-local' type='date'
name='period_from' name='period_from'
placeholder='Period From' placeholder='Period From'
/> />
</FormField> </FormField>
<FormField label='Period To'> <FormField label='Period To'>
<Field <Field type='date' name='period_to' placeholder='Period To' />
type='datetime-local'
name='period_to'
placeholder='Period To'
/>
</FormField> </FormField>
<BaseDivider /> <BaseDivider />

View File

@ -28,12 +28,7 @@ const PeriodsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([ const [filters] = useState([{ label: 'Name', title: 'name' }]);
{ label: 'Name', title: 'name' },
{ label: 'Period From', title: 'period_from', date: 'true' },
{ label: 'Period To', title: 'period_to', date: 'true' },
]);
const hasCreatePermission = const hasCreatePermission =
currentUser && hasPermission(currentUser, 'CREATE_PERIODS'); currentUser && hasPermission(currentUser, 'CREATE_PERIODS');

View File

@ -62,7 +62,7 @@ const PeriodsView = () => {
<FormField label='Period From'> <FormField label='Period From'>
{periods.period_from ? ( {periods.period_from ? (
<DatePicker <DatePicker
dateFormat='yyyy-MM-dd hh:mm' dateFormat='yyyy-MM-dd'
showTimeSelect showTimeSelect
selected={ selected={
periods.period_from periods.period_from
@ -81,7 +81,7 @@ const PeriodsView = () => {
<FormField label='Period To'> <FormField label='Period To'>
{periods.period_to ? ( {periods.period_to ? (
<DatePicker <DatePicker
dateFormat='yyyy-MM-dd hh:mm' dateFormat='yyyy-MM-dd'
showTimeSelect showTimeSelect
selected={ selected={
periods.period_to periods.period_to

1
pids/backend.pid Normal file
View File

@ -0,0 +1 @@
4

1
pids/frontend.pid Normal file
View File

@ -0,0 +1 @@
3