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-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-nPB174iT0teN6e3vXRCoRu7WWSyX6Bl1psRKXVJQgiKIQ4gF+o6CaHsZF+4mewtpG8StZ0u7lOvt8d8UzD5x2w==",
"shasum": "2b10ad2ec05dc2a08dfa70263862914c482afaa4",
"tarball": "https://registry.npmjs.org/3pm-timesheet-module/-/3pm-timesheet-module-1.3.4.tgz",
"fileCount": 35,
"unpackedSize": 67460,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwZlACRA9TVsSAnZWagAAUtwP/A1yjno+zI7Gv1VD42QR\nYUUenqkCTp2Dv463rZ6dE6o91Wx+uK1+qfwxX6L1NuZwJR3tLlFznNnNTwW0\niD7CShrm1ALUf/1c/RxmGYseGsaK36GePq45EeznnsM/lZY8OVqEpAe7i5kT\nJOESGUPrdy3hxmAM35FzC+Ggf+XI4K0dL0rFk5xb5LAld3zEDcUOEIHkk7kE\n8E8b8CXT6DUXXDjl7C/uJRIb5KnnT63J4nqUqCcXPIm24DjBr1lPvHXjWLgj\n9ixbLaljFmS1hebJd/5p86QvbI5HB1K8WWfYyAGhZSVwd0/A+6x/eZ1Im7UR\nZFrDliN3nQ7HBO0A2iahZ9EYKuOvir/a/d5gZCnh1GWnEiLEE0WaHfSbEI5p\nGLP9YaW28xVtiX/qQtaw8IAdPGiERbC4PVC/XwwqbjDHei99GIurIX6iRH5b\nBDpikEIjaqMJ8g7AhJqKWFr0CDtLJebG+j+vvg548ssAwJ3U0diCSu0x9YHa\nONEMmWXXYRok8WYunwFwYBozLD5gGFobSRyfdPIFYReAy+xIwUuNuuhsmaKw\nY8fGCb42CqaDPfN1YRtC3sE9OobHC9MJrL9+gFEz6Aq5IL9K0Hiff2b+8f1Q\nQnQXA79TP9AbD8YRE6Z4i5/HUl89YMfxyxPPLGLIHLQ+57/nvAUlTVEPyOfB\nGmtI\r\n=tAV2\r\n-----END PGP SIGNATURE-----\r\n",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEYCIQCovfRu5qnkRpbIYUMPJsMhfO6B2znyiA5cTRZJ13W6BgIhALo/LfNIGgEtHPLZXxB0do0Fy2sSWbT5OL+UgJgfEJ1o"
}
]
}Observed since 20 Oct, 19:50 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:e978223dc3afa16b1a0b89cf420d7d5663fd1c79ac69e4decfd0b764ebf83fce