This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Entity, | |
FieldRef, | |
Fields, | |
FieldsRef, | |
getEntityRef, | |
IdEntity, | |
isBackend, | |
LifecycleEvent, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new Proxy(db, { | |
get(target, prop) { | |
if (prop == 'getEntityDataProvider') { | |
return (meta: EntityMetadata) => { | |
return new Proxy(db.getEntityDataProvider(meta), { | |
get(target, prop) { | |
if (prop == 'find') { | |
return async (options: EntityDataProviderFindOptions) => { | |
const start = performance.now(); | |
const result = await target.find(options); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function bulkInsert<entityType extends EntityBase>( | |
array: entityType[], | |
db: SqlDatabase, | |
) { | |
if (array.length == 0) return | |
const chunkSize = 250 | |
for (let i = 0; i < array.length; i += chunkSize) { | |
const items = array.slice(i, i + chunkSize) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataProvider: async () => { | |
const result = await createKnexDataProvider({ | |
client: 'mssql', | |
//debug: true, | |
connection: { | |
server: process.env['DBServer'], | |
database: process.env['DBDatabase'], | |
user: process.env['DBUser'], | |
password: process.env['DBPassword'], | |
query_timeout: 30000, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Checks if a filter contains a specific field | |
* @example | |
backendPreprocessFilter: async (filter) => { | |
// If not specific filter for deletedBy was specified - only show non deleted rows | |
if (!filterContains(filter, 'deletedBy')) { | |
return { | |
...filter, | |
deletedBy: null, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Firefly.Box; | |
using Firefly.Box.Data.Advanced; | |
using ENV.Data.DataProvider; | |
using Firefly.Box.Data.DataProvider; | |
OlderNewer