This file contains 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; |
This file contains 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 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 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 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 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 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
body { | |
font-family: Arial, Helvetica, sans-serif; | |
background-color: #f5f5f5; | |
display: flex; | |
justify-content: center; | |
font-size:x-large | |
} | |
input{ | |
font-size: x-large; | |
min-width: 18px; |
This file contains 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 glob from 'glob'; | |
import path from 'path'; | |
for (const type of ["entity", "controller"]) { | |
for (const ext of ["js", "ts"]) { | |
for (const file of glob.sync(`src/**/*.${type}.${ext}`)) { | |
require(path.resolve(file)) | |
} | |
} | |
} |
This file contains 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
create table Person( | |
social_security_number int, | |
name varchar(50) | |
) | |
create table transactions( | |
person_social_security_number int, | |
month int, | |
amount decimal | |
) |
This file contains 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
# See http://help.github.com/ignore-files/ for more about ignoring files. | |
# compiled output | |
/dist | |
/tmp | |
/out-tsc | |
# Only exists if Bazel was run | |
/bazel-out | |
# dependencies |
NewerOlder