Catalog npm
Back to packageRELEASE DETAILS

1.3.4

npm

3pm-timesheet-module

![NPM](https://img.shields.io/npm/v/3pm-timesheet-module.svg)

Published10 Jun 2021
Direct dependencies26
Transitive dependenciesNot calculated

README

Current package documentation

NPM

3PM Packages

Following included packages:
  • Timesheet Package
  • Leave Request Package
Please refer to the wiki for the following:

Adding checkboxes for approving timesheets

Adding API success and error logging

Timesheet Module

Installation

$ 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

Features

  • Sign in / Sign out
  • Start new jobs when signing out
  • Selecting multiple assets to assign hours too hasMultiAssets should be set to TRUE() in app.
  • Selecting one asset. hasOneAsset should be set to TRUE() in mobile app.

Usage

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
    })
  }
})

👀 Timesheet Props

PropDescriptionTypeRequired
payloadData payload from appobjectYes
lookupObject to map keys / fields{key: field}Yes
createRecordFunction to create timesheet recordfn(obj_num, data, retry?)Yes
updateRecordFunction to update timesheet recordfn(obj_num, data, id, retry?)Yes
getAllRecordsFunction to get record by timesheet IDfn(obj_num, filer?, retry?)Yes
objectNumKnack object # for where payload is going toonumberYes
assetObjectFunction to get record by timesheet IDnumberNo

Leave Request Module

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
    })
  }
})

👀 Leave Props

PropDescriptionTypeRequired
payloadData payload from appobjectYes
lookupObject to map keys / fields{key: field}Yes
createRecordFunction to create leave recordfn(obj_num, data, retry?)Yes
objectNumObject to create records innumberYes

📝 Changelog

For every major or minor release changelog/migration-guide will be available in releases

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 26

Native requirements
26 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@types/express
Environment
{
  "local_name": "@types/express",
  "alias": false,
  "peer_metadata": null
}
^4.17.12runtime
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^15.12.2runtime
cors
Environment
{
  "local_name": "cors",
  "alias": false,
  "peer_metadata": null
}
^2.8.5runtime
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^10.0.0runtime
express
Environment
{
  "local_name": "express",
  "alias": false,
  "peer_metadata": null
}
^4.17.1runtime
form-data
Environment
{
  "local_name": "form-data",
  "alias": false,
  "peer_metadata": null
}
^3.0.1runtime
moment-timezone
Environment
{
  "local_name": "moment-timezone",
  "alias": false,
  "peer_metadata": null
}
^0.5.33runtime
node-fetch
Environment
{
  "local_name": "node-fetch",
  "alias": false,
  "peer_metadata": null
}
^2.6.1runtime
request
Environment
{
  "local_name": "request",
  "alias": false,
  "peer_metadata": null
}
^2.88.2runtime
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^10.0.0runtime
tslint
Environment
{
  "local_name": "tslint",
  "alias": false,
  "peer_metadata": null
}
^6.1.3runtime
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^4.2.4runtime
winston
Environment
{
  "local_name": "winston",
  "alias": false,
  "peer_metadata": null
}
^3.3.3runtime
winston-loggly-bulk
Environment
{
  "local_name": "winston-loggly-bulk",
  "alias": false,
  "peer_metadata": null
}
^3.2.1runtime
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^26.0.23development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
4.22.0development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
4.22.0development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
7.25.0development
eslint-config-airbnb
Environment
{
  "local_name": "eslint-config-airbnb",
  "alias": false,
  "peer_metadata": null
}
18.2.1development
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
^8.3.0development
eslint-plugin-prettier
Environment
{
  "local_name": "eslint-plugin-prettier",
  "alias": false,
  "peer_metadata": null
}
^3.4.0development
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^26.6.3development
lint-staged
Environment
{
  "local_name": "lint-staged",
  "alias": false,
  "peer_metadata": null
}
10.5.4development
nodemon
Environment
{
  "local_name": "nodemon",
  "alias": false,
  "peer_metadata": null
}
^2.0.7development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^2.2.1development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^26.5.5development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "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"
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:50 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:e978223dc3afa16b1a0b89cf420d7d5663fd1c79ac69e4decfd0b764ebf83fce

Other collected versions

1.5.018 Jun1.4.818 Jun1.4.615 Jun1.4.515 Jun1.4.414 Jun1.4.314 JunView all collected versions →