Updated via schema editor on 2025-06-19 01:28
This commit is contained in:
parent
8bb05f8fbb
commit
a74660b879
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,3 +4,6 @@ node_modules/
|
|||||||
*/node_modules/
|
*/node_modules/
|
||||||
**/node_modules/
|
**/node_modules/
|
||||||
*/build/
|
*/build/
|
||||||
|
**/build/
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@ module.exports = class UnitsDBApi {
|
|||||||
|
|
||||||
unit_number: data.unit_number || null,
|
unit_number: data.unit_number || null,
|
||||||
balance: data.balance || null,
|
balance: data.balance || null,
|
||||||
|
unit_factor: data.unit_factor || null,
|
||||||
importHash: data.importHash || null,
|
importHash: data.importHash || null,
|
||||||
createdById: currentUser.id,
|
createdById: currentUser.id,
|
||||||
updatedById: currentUser.id,
|
updatedById: currentUser.id,
|
||||||
@ -41,6 +42,7 @@ module.exports = class UnitsDBApi {
|
|||||||
|
|
||||||
unit_number: item.unit_number || null,
|
unit_number: item.unit_number || null,
|
||||||
balance: item.balance || null,
|
balance: item.balance || null,
|
||||||
|
unit_factor: item.unit_factor || null,
|
||||||
importHash: item.importHash || null,
|
importHash: item.importHash || null,
|
||||||
createdById: currentUser.id,
|
createdById: currentUser.id,
|
||||||
updatedById: currentUser.id,
|
updatedById: currentUser.id,
|
||||||
@ -68,6 +70,9 @@ module.exports = class UnitsDBApi {
|
|||||||
|
|
||||||
if (data.balance !== undefined) updatePayload.balance = data.balance;
|
if (data.balance !== undefined) updatePayload.balance = data.balance;
|
||||||
|
|
||||||
|
if (data.unit_factor !== undefined)
|
||||||
|
updatePayload.unit_factor = data.unit_factor;
|
||||||
|
|
||||||
updatePayload.updatedById = currentUser.id;
|
updatePayload.updatedById = currentUser.id;
|
||||||
|
|
||||||
await units.update(updatePayload, { transaction });
|
await units.update(updatePayload, { transaction });
|
||||||
@ -233,6 +238,30 @@ module.exports = class UnitsDBApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filter.unit_factorRange) {
|
||||||
|
const [start, end] = filter.unit_factorRange;
|
||||||
|
|
||||||
|
if (start !== undefined && start !== null && start !== '') {
|
||||||
|
where = {
|
||||||
|
...where,
|
||||||
|
unit_factor: {
|
||||||
|
...where.unit_factor,
|
||||||
|
[Op.gte]: start,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end !== undefined && end !== null && end !== '') {
|
||||||
|
where = {
|
||||||
|
...where,
|
||||||
|
unit_factor: {
|
||||||
|
...where.unit_factor,
|
||||||
|
[Op.lte]: end,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (filter.active !== undefined) {
|
if (filter.active !== undefined) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
|
|||||||
49
backend/src/db/migrations/1750296469103.js
Normal file
49
backend/src/db/migrations/1750296469103.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
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(
|
||||||
|
'units',
|
||||||
|
'unit_factor',
|
||||||
|
{
|
||||||
|
type: Sequelize.DataTypes.INTEGER,
|
||||||
|
},
|
||||||
|
{ 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('units', 'unit_factor', {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
|
} catch (err) {
|
||||||
|
await transaction.rollback();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -22,6 +22,10 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
type: DataTypes.DECIMAL,
|
type: DataTypes.DECIMAL,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
unit_factor: {
|
||||||
|
type: DataTypes.INTEGER,
|
||||||
|
},
|
||||||
|
|
||||||
importHash: {
|
importHash: {
|
||||||
type: DataTypes.STRING(255),
|
type: DataTypes.STRING(255),
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
|
|||||||
@ -85,7 +85,7 @@ const MaintenanceRequestsData = [
|
|||||||
|
|
||||||
description: 'Leaking faucet in kitchen',
|
description: 'Leaking faucet in kitchen',
|
||||||
|
|
||||||
status: 'in_progress',
|
status: 'completed',
|
||||||
|
|
||||||
request_date: new Date('2023-10-01T10:00:00Z'),
|
request_date: new Date('2023-10-01T10:00:00Z'),
|
||||||
},
|
},
|
||||||
@ -105,7 +105,7 @@ const MaintenanceRequestsData = [
|
|||||||
|
|
||||||
description: 'Heating not working',
|
description: 'Heating not working',
|
||||||
|
|
||||||
status: 'in_progress',
|
status: 'pending',
|
||||||
|
|
||||||
request_date: new Date('2023-09-20T09:00:00Z'),
|
request_date: new Date('2023-09-20T09:00:00Z'),
|
||||||
},
|
},
|
||||||
@ -115,7 +115,7 @@ const MaintenanceRequestsData = [
|
|||||||
|
|
||||||
description: 'Elevator malfunction',
|
description: 'Elevator malfunction',
|
||||||
|
|
||||||
status: 'completed',
|
status: 'in_progress',
|
||||||
|
|
||||||
request_date: new Date('2023-10-02T11:15:00Z'),
|
request_date: new Date('2023-10-02T11:15:00Z'),
|
||||||
},
|
},
|
||||||
@ -170,6 +170,8 @@ const UnitsData = [
|
|||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
balance: 250,
|
balance: 250,
|
||||||
|
|
||||||
|
unit_factor: 3,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -178,6 +180,8 @@ const UnitsData = [
|
|||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
balance: 0,
|
balance: 0,
|
||||||
|
|
||||||
|
unit_factor: 7,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -186,6 +190,8 @@ const UnitsData = [
|
|||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
balance: 150,
|
balance: 150,
|
||||||
|
|
||||||
|
unit_factor: 8,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -194,6 +200,8 @@ const UnitsData = [
|
|||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
balance: 0,
|
balance: 0,
|
||||||
|
|
||||||
|
unit_factor: 6,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,10 @@ router.use(checkCrudPermissions('units'));
|
|||||||
* type: string
|
* type: string
|
||||||
* default: unit_number
|
* default: unit_number
|
||||||
|
|
||||||
|
* unit_factor:
|
||||||
|
* type: integer
|
||||||
|
* format: int64
|
||||||
|
|
||||||
* balance:
|
* balance:
|
||||||
* type: integer
|
* type: integer
|
||||||
* format: int64
|
* format: int64
|
||||||
@ -303,7 +307,7 @@ router.get(
|
|||||||
const currentUser = req.currentUser;
|
const currentUser = req.currentUser;
|
||||||
const payload = await UnitsDBApi.findAll(req.query, { currentUser });
|
const payload = await UnitsDBApi.findAll(req.query, { currentUser });
|
||||||
if (filetype && filetype === 'csv') {
|
if (filetype && filetype === 'csv') {
|
||||||
const fields = ['id', 'unit_number', 'balance'];
|
const fields = ['id', 'unit_number', 'unit_factor', 'balance'];
|
||||||
const opts = { fields };
|
const opts = { fields };
|
||||||
try {
|
try {
|
||||||
const csv = parse(payload.rows, opts);
|
const csv = parse(payload.rows, opts);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ module.exports = class SearchService {
|
|||||||
const columnsInt = {
|
const columnsInt = {
|
||||||
budgets: ['year', 'total_budget', 'expenses'],
|
budgets: ['year', 'total_budget', 'expenses'],
|
||||||
|
|
||||||
units: ['balance'],
|
units: ['balance', 'unit_factor'],
|
||||||
};
|
};
|
||||||
|
|
||||||
let allFoundRecords = [];
|
let allFoundRecords = [];
|
||||||
|
|||||||
14
cloudbuild.yaml
Normal file
14
cloudbuild.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
steps:
|
||||||
|
- name: 'gcr.io/cloud-builders/docker'
|
||||||
|
entrypoint: 'bash'
|
||||||
|
args: ['-c', 'docker pull gcr.io/fldemo-315215/condocloud-32325-dev:latest || exit 0']
|
||||||
|
- name: 'gcr.io/cloud-builders/docker'
|
||||||
|
args: [
|
||||||
|
'build',
|
||||||
|
'-t', 'gcr.io/fldemo-315215/condocloud-32325-dev:latest',
|
||||||
|
'--file', 'Dockerfile.dev',
|
||||||
|
'--cache-from', 'gcr.io/fldemo-315215/condocloud-32325-dev:latest',
|
||||||
|
'.'
|
||||||
|
]
|
||||||
|
images: ['gcr.io/fldemo-315215/condocloud-32325-dev:latest']
|
||||||
|
logsBucket: 'gs://fldemo-315215-cloudbuild-logs'
|
||||||
2
frontend/next-env.d.ts
vendored
2
frontend/next-env.d.ts
vendored
@ -2,4 +2,4 @@
|
|||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
// 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.
|
||||||
|
|||||||
@ -106,6 +106,17 @@ const CardUnits = ({
|
|||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
|
Unit Factor
|
||||||
|
</dt>
|
||||||
|
<dd className='flex items-start gap-x-2'>
|
||||||
|
<div className='font-medium line-clamp-4'>
|
||||||
|
{item.unit_factor}
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -67,6 +67,11 @@ const ListUnits = ({
|
|||||||
<p className={'text-xs text-gray-500 '}>Balance</p>
|
<p className={'text-xs text-gray-500 '}>Balance</p>
|
||||||
<p className={'line-clamp-2'}>{item.balance}</p>
|
<p className={'line-clamp-2'}>{item.balance}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className={'flex-1 px-3'}>
|
||||||
|
<p className={'text-xs text-gray-500 '}>Unit Factor</p>
|
||||||
|
<p className={'line-clamp-2'}>{item.unit_factor}</p>
|
||||||
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<ListActionsPopover
|
<ListActionsPopover
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
|
|||||||
@ -84,6 +84,20 @@ export const loadColumns = async (
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
field: 'unit_factor',
|
||||||
|
headerName: 'Unit Factor',
|
||||||
|
flex: 1,
|
||||||
|
minWidth: 120,
|
||||||
|
filterable: false,
|
||||||
|
headerClassName: 'datagrid--header',
|
||||||
|
cellClassName: 'datagrid--cell',
|
||||||
|
|
||||||
|
editable: hasUpdatePermission,
|
||||||
|
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
type: 'actions',
|
type: 'actions',
|
||||||
|
|||||||
@ -41,6 +41,8 @@ const EditUnits = () => {
|
|||||||
owner: null,
|
owner: null,
|
||||||
|
|
||||||
balance: '',
|
balance: '',
|
||||||
|
|
||||||
|
unit_factor: '',
|
||||||
};
|
};
|
||||||
const [initialValues, setInitialValues] = useState(initVals);
|
const [initialValues, setInitialValues] = useState(initVals);
|
||||||
|
|
||||||
@ -112,6 +114,14 @@ const EditUnits = () => {
|
|||||||
<Field type='number' name='balance' placeholder='Balance' />
|
<Field type='number' name='balance' placeholder='Balance' />
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
<FormField label='Unit Factor'>
|
||||||
|
<Field
|
||||||
|
type='number'
|
||||||
|
name='unit_factor'
|
||||||
|
placeholder='Unit Factor'
|
||||||
|
/>
|
||||||
|
</FormField>
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
<BaseButton type='submit' color='info' label='Submit' />
|
||||||
|
|||||||
@ -41,6 +41,8 @@ const EditUnitsPage = () => {
|
|||||||
owner: null,
|
owner: null,
|
||||||
|
|
||||||
balance: '',
|
balance: '',
|
||||||
|
|
||||||
|
unit_factor: '',
|
||||||
};
|
};
|
||||||
const [initialValues, setInitialValues] = useState(initVals);
|
const [initialValues, setInitialValues] = useState(initVals);
|
||||||
|
|
||||||
@ -110,6 +112,14 @@ const EditUnitsPage = () => {
|
|||||||
<Field type='number' name='balance' placeholder='Balance' />
|
<Field type='number' name='balance' placeholder='Balance' />
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
<FormField label='Unit Factor'>
|
||||||
|
<Field
|
||||||
|
type='number'
|
||||||
|
name='unit_factor'
|
||||||
|
placeholder='Unit Factor'
|
||||||
|
/>
|
||||||
|
</FormField>
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
<BaseButton type='submit' color='info' label='Submit' />
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const UnitsTablesPage = () => {
|
|||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([
|
||||||
{ label: 'UnitNumber', title: 'unit_number' },
|
{ label: 'UnitNumber', title: 'unit_number' },
|
||||||
|
{ label: 'Unit Factor', title: 'unit_factor', number: 'true' },
|
||||||
{ label: 'Balance', title: 'balance', number: 'true' },
|
{ label: 'Balance', title: 'balance', number: 'true' },
|
||||||
|
|
||||||
{ label: 'Owner', title: 'owner' },
|
{ label: 'Owner', title: 'owner' },
|
||||||
|
|||||||
@ -38,6 +38,8 @@ const initialValues = {
|
|||||||
owner: '',
|
owner: '',
|
||||||
|
|
||||||
balance: '',
|
balance: '',
|
||||||
|
|
||||||
|
unit_factor: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const UnitsNew = () => {
|
const UnitsNew = () => {
|
||||||
@ -85,6 +87,14 @@ const UnitsNew = () => {
|
|||||||
<Field type='number' name='balance' placeholder='Balance' />
|
<Field type='number' name='balance' placeholder='Balance' />
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
<FormField label='Unit Factor'>
|
||||||
|
<Field
|
||||||
|
type='number'
|
||||||
|
name='unit_factor'
|
||||||
|
placeholder='Unit Factor'
|
||||||
|
/>
|
||||||
|
</FormField>
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
<BaseButton type='submit' color='info' label='Submit' />
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const UnitsTablesPage = () => {
|
|||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([
|
||||||
{ label: 'UnitNumber', title: 'unit_number' },
|
{ label: 'UnitNumber', title: 'unit_number' },
|
||||||
|
{ label: 'Unit Factor', title: 'unit_factor', number: 'true' },
|
||||||
{ label: 'Balance', title: 'balance', number: 'true' },
|
{ label: 'Balance', title: 'balance', number: 'true' },
|
||||||
|
|
||||||
{ label: 'Owner', title: 'owner' },
|
{ label: 'Owner', title: 'owner' },
|
||||||
|
|||||||
@ -70,6 +70,11 @@ const UnitsView = () => {
|
|||||||
<p>{units?.balance || 'No data'}</p>
|
<p>{units?.balance || 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className={'mb-4'}>
|
||||||
|
<p className={'block font-bold mb-2'}>Unit Factor</p>
|
||||||
|
<p>{units?.unit_factor || 'No data'}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Maintenance_requests Unit</p>
|
<p className={'block font-bold mb-2'}>Maintenance_requests Unit</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
|
|||||||
@ -151,6 +151,8 @@ const UsersView = () => {
|
|||||||
<th>UnitNumber</th>
|
<th>UnitNumber</th>
|
||||||
|
|
||||||
<th>Balance</th>
|
<th>Balance</th>
|
||||||
|
|
||||||
|
<th>Unit Factor</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -166,6 +168,8 @@ const UsersView = () => {
|
|||||||
<td data-label='unit_number'>{item.unit_number}</td>
|
<td data-label='unit_number'>{item.unit_number}</td>
|
||||||
|
|
||||||
<td data-label='balance'>{item.balance}</td>
|
<td data-label='balance'>{item.balance}</td>
|
||||||
|
|
||||||
|
<td data-label='unit_factor'>{item.unit_factor}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
1
pids/backend.pid
Normal file
1
pids/backend.pid
Normal file
@ -0,0 +1 @@
|
|||||||
|
4
|
||||||
1
pids/frontend.pid
Normal file
1
pids/frontend.pid
Normal file
@ -0,0 +1 @@
|
|||||||
|
3
|
||||||
Loading…
x
Reference in New Issue
Block a user