Current collected state Current
Observed since 20 Oct, 19:50 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3pm-timesheet-module

Adding checkboxes for approving timesheets
Adding API success and error logging
$ npm install 3pm-timesheet-module
You will also need to setup an express server if you haven't done so.
$ npm install express cors nodemon
hasMultiAssets should be set to TRUE() in app.hasOneAsset should be set to TRUE() in mobile app.This is a basic example on how we can setup our server and implement the Timesheet module.
const express = require('express');
const cors = require('cors');
const { Timesheet } = require('3pm-timesheet-module');
const { knack } = require('./api') // Knack API functions
const app = express();
const PORT = process.env.PORT || 8000;
app.use(cors());
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.post('/api/timesheet', async (req, res) => {
const payload = req.body.Entry;
const {
createRecord,
updateRecord,
getAllRecords
} = knack; // API functions
try {
const fieldLookup = {
timesheetID: "field_9",
signinDateTime: "field_5",
signoutDateTime: "field_10",
staffConnection: "field_6",
staffName: "field_16",
jobConnection: "field_7",
signinLocation: "field_8",
signoutLocation: "field_11",
lunch: "field_14",
comments: "field_13",
};
await Timesheet(payload, fieldLookup, createRecord, updateRecord, getAllRecords);
res.status(200).send('Successfully created/updated timesheet entry.');
} catch(err) {
res.status(400).json({
message: 'Failed creating/updating timesheet.',
error: err
})
}
})
| Prop | Description | Type | Required |
|---|---|---|---|
payload | Data payload from app | object | Yes |
lookup | Object to map keys / fields | {key: field} | Yes |
createRecord | Function to create timesheet record | fn(obj_num, data, retry?) | Yes |
updateRecord | Function to update timesheet record | fn(obj_num, data, id, retry?) | Yes |
getAllRecords | Function to get record by timesheet ID | fn(obj_num, filer?, retry?) | Yes |
objectNum | Knack object # for where payload is going too | number | Yes |
assetObject | Function to get record by timesheet ID | number | No |
Here is a basic example on how we could implement the leave process.
app.post('/api/leave', async (req, res) => {
const { createRecord } = knack;
try {
res.status(200).send('Successfully created leave entry.')
const fieldLookup = {
firstDay: "field_21",
lastDay: "field_22",
days: "field_23",
staffConnection: "field_18",
leaveType: "field_19",
otherLeaveType: "field_20",
leaveComments: "field_25",
}
const objectNum = 4;
await Leave(req.body.Entry, fieldLookup, createRecord, objectNum)
} catch (err) {
res.status(400).json({
message: 'Failed creating leave request.',
error: err
})
}
})
| Prop | Description | Type | Required |
|---|---|---|---|
payload | Data payload from app | object | Yes |
lookup | Object to map keys / fields | {key: field} | Yes |
createRecord | Function to create leave record | fn(obj_num, data, retry?) | Yes |
objectNum | Object to create records in | number | Yes |
For every major or minor release changelog/migration-guide will be available in releases
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@types/expressEnvironment{
"local_name": "@types/express",
"alias": false,
"peer_metadata": null
} | ^4.17.12 | runtime |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^15.12.2 | runtime |
corsEnvironment{
"local_name": "cors",
"alias": false,
"peer_metadata": null
} | ^2.8.5 | runtime |
dotenvEnvironment{
"local_name": "dotenv",
"alias": false,
"peer_metadata": null
} | ^10.0.0 | runtime |
expressEnvironment{
"local_name": "express",
"alias": false,
"peer_metadata": null
} | ^4.17.1 | runtime |
form-dataEnvironment{
"local_name": "form-data",
"alias": false,
"peer_metadata": null
} | ^3.0.1 | runtime |
moment-business-daysEnvironment{
"local_name": "moment-business-days",
"alias": false,
"peer_metadata": null
} | ^1.2.0 | runtime |
moment-timezoneEnvironment{
"local_name": "moment-timezone",
"alias": false,
"peer_metadata": null
} | ^0.5.33 | runtime |
node-fetchEnvironment{
"local_name": "node-fetch",
"alias": false,
"peer_metadata": null
} | ^2.6.1 | runtime |
requestEnvironment{
"local_name": "request",
"alias": false,
"peer_metadata": null
} | ^2.88.2 | runtime |
ts-nodeEnvironment{
"local_name": "ts-node",
"alias": false,
"peer_metadata": null
} | ^10.0.0 | runtime |
tslintEnvironment{
"local_name": "tslint",
"alias": false,
"peer_metadata": null
} | ^6.1.3 | runtime |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^4.2.4 | runtime |
winstonEnvironment{
"local_name": "winston",
"alias": false,
"peer_metadata": null
} | ^3.3.3 | runtime |
winston-loggly-bulkEnvironment{
"local_name": "winston-loggly-bulk",
"alias": false,
"peer_metadata": null
} | ^3.2.1 | runtime |
@types/jestEnvironment{
"local_name": "@types/jest",
"alias": false,
"peer_metadata": null
} | ^26.0.23 | development |
@typescript-eslint/eslint-pluginEnvironment{
"local_name": "@typescript-eslint/eslint-plugin",
"alias": false,
"peer_metadata": null
} | 4.22.0 | development |
@typescript-eslint/parserEnvironment{
"local_name": "@typescript-eslint/parser",
"alias": false,
"peer_metadata": null
} | 4.22.0 | development |
eslintEnvironment{
"local_name": "eslint",
"alias": false,
"peer_metadata": null
} | 7.25.0 | development |
eslint-config-airbnbEnvironment{
"local_name": "eslint-config-airbnb",
"alias": false,
"peer_metadata": null
} | 18.2.1 | development |
eslint-config-prettierEnvironment{
"local_name": "eslint-config-prettier",
"alias": false,
"peer_metadata": null
} | ^8.3.0 | development |
eslint-plugin-prettierEnvironment{
"local_name": "eslint-plugin-prettier",
"alias": false,
"peer_metadata": null
} | ^3.4.0 | development |
jestEnvironment{
"local_name": "jest",
"alias": false,
"peer_metadata": null
} | ^26.6.3 | development |
lint-stagedEnvironment{
"local_name": "lint-staged",
"alias": false,
"peer_metadata": null
} | 10.5.4 | development |
nodemonEnvironment{
"local_name": "nodemon",
"alias": false,
"peer_metadata": null
} | ^2.0.7 | development |
prettierEnvironment{
"local_name": "prettier",
"alias": false,
"peer_metadata": null
} | ^2.2.1 | development |
ts-jestEnvironment{
"local_name": "ts-jest",
"alias": false,
"peer_metadata": null
} | ^26.5.5 | development |
Source distribution
{
"integrity": "sha512-TLIL4ZSx/7HvvUhefdbEsgX5KdIrFi9Ykp1s23nwUWlLD6+e2mahOiY0ldn/L+o7+a6YyBgKdh5jFJrYhO5mzA==",
"shasum": "d00677f2db3776d6d4fae15eda2e93b53d9a0ede",
"tarball": "https://registry.npmjs.org/3pm-timesheet-module/-/3pm-timesheet-module-1.4.2.tgz",
"fileCount": 39,
"unpackedSize": 73701,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwo/PCRA9TVsSAnZWagAAmm0P/R4XqAsWyryY+xqMB1f6\nhTpNHsryi1KjIrIoMblBd+W1jbxDqx92SGIiL8gr/jOprxJbTXtoEyvnLY1W\nfr8lKBpENRZE9blO82LM66O9Q9lp/Zd4RoHDUM7z8hd2I7A1EETxm9AGAVVP\nVsFGB2umDNzusOHyCayqcB5Cj6f/83JArWLx5koeoLcndm7MLixDf5up6JKi\nnJg49Wah1aqD9xLA0PU7e1a/2XidvB9LFPM2HEz4y7ARjmiTgD1wHrio6f2A\niFne0qA2XZ3uYdnodPDmZ6oqcinlNPBPt3iVaPL4gBVWZMmyoPygPgk9Ki0x\n/1nBqp1yH+psymr7XsRFCdMeB5gFdhhJhuPISP1Vr9rAuBw3mAhNth0qdAMx\nciaoSH8O3N//KannmLAuMm2keK+EywyxvH2z8kP4+tzArFAGFH4dgrqZTHB1\nu1tmILov3jmTjMENXbi3E0sMAuGKk93ETEy8hYjR8Bz68JeLUH8BE5VyiiZs\n4EVQfMSU0tUva3DtSUeAI88zCfRZAnTwckctbda/NIdEoRrP9jxobOaTGmGK\nxLMQxNI0G4wz0KvMmi8te3B1gT1X30Wq1nilk2GTBnc7W/eymv5DP1dQ1GmR\nJNybpgZA7NpnKRpgyTxVkYZOqoDyKxgg3M9JccnFSD/qwNqfddAiur/a4k1f\nQqdN\r\n=yUpr\r\n-----END PGP SIGNATURE-----\r\n",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEQCIDgx7Ut4IQklRXeoJtlS/cwNq83GcLvoc+egfDui/5G3AiAsThkafsmku3ofZlNEWL0huKGV2550csaFww2WZbql4w=="
}
]
}Observed since 20 Oct, 19:50 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:9498d430268c48d331f781e9347551ea6b63be81990a2fbe5273ee4c35a2c811