# equity-report-api

> Equity Report 2019 Typescript API

Latest version **0.0.1** (published 2019-08-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install equity-report-api
pnpm add equity-report-api
yarn add equity-report-api
bun add equity-report-api
```

Provides the command `nu`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2019-08-26 |
| First published | 2019-08-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 127.7 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | maderaunified |

## Links

- npm: https://www.npmjs.com/package/equity-report-api
- Repository: https://github.com/spacebartech/equity-report-api
- Homepage: https://github.com/spacebartech/equity-report-api#readme
- Issues: https://github.com/spacebartech/equity-report-api/issues
- npm.io page: https://npm.io/package/equity-report-api

## Dependencies (15)

- [cors](https://npm.io/package/cors.md) ^2.8.5
- [https](https://npm.io/package/https.md) ^1.0.0
- [mssql](https://npm.io/package/mssql.md) ^5.1.0
- [dotenv](https://npm.io/package/dotenv.md) ^8.1.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [tedious](https://npm.io/package/tedious.md) ^6.3.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.5
- [celebrate](https://npm.io/package/celebrate.md) ^10.0.1
- [deepmerge](https://npm.io/package/deepmerge.md) ^3.3.0
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [lodash.has](https://npm.io/package/lodash.has.md) ^4.5.2
- [lodash.set](https://npm.io/package/lodash.set.md) ^4.3.2
- [lodash.setwith](https://npm.io/package/lodash.setwith.md) ^4.3.2
- [@jetstech/utils](https://npm.io/package/@jetstech/utils.md) ^0.1.1
- [@maderaunified/musd-saml](https://npm.io/package/@maderaunified/musd-saml.md) ^2.0.3

## Recent versions

- 0.0.1 (latest) — 2019-08-26

## README

# Equity Report API

Equity Report 2019 Typescript API

## Usage

### Installation

```sh
# using ssh
git clone git@github.com:SpacebarTech/equity-report-api

# using https
git clone https://github.com/SpacebarTech/equity-report-api.git
```

### Contributing

#### Folder structure

```perl
.vscode/
  settings.json      # disable Jest, use Typescript@x.y.z, etc.
  snippets.code-snippets # project snippets.
bin/                 # nodejs bin scripts.
  nu.js              # bin script to create all the things.
src/                 # all project files.
  controllers/       # route logic ONLY
    {entity}/        # PLURAL; e.g. users, panes, etc.
      {verb}/        # LOWERCASE; get, put, post, patch, delete, etc.
        router.ts    # the router itself.
        validator.ts # the validator for a specific verb's router.
  helpers/           # helper functions and enums, not including type defs.
    enums/           # enums go here.
    executeSproc.ts  # the primary function of executing sprocs.
  lib/               # business logic goes here.
    {entity}/        # SINGULAR; logic for specific entity (e.g. user, pane, etc.)
      repo.ts        # the primary method of hitting a sproc for a given entity.
      service.ts     # calls repo method and transforms it for frontend.
  index.ts           # the entry-point of the project.
  server.ts          # server logic itself.
.editorconfig
.gitignore
.nvmrc
nodemon.json
README.md
package.json
tsconfig.json
tslint.json
```

#### Path mapping

In Typescript, you can [map paths](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping)
in order to avoid the use of `../../../../` all over the
place in your code. Each folder in `src` has a map as
specified in the `tsconfig.json`. So instead of writing

```ts
// src/lib/user/service.ts

import myHelperFunction from '../../helpers/myHelperFunction';
```

You would now write

```ts
import myHelperFunction from 'helpers/myHelperFunction';
```

#### `nu`

There's an available bin script called `nu` (pronounced
"new"). Executing this command will make a new `entity`
folder, with a `repo` and a `service` file, as well as will
make all necessary `router`s and `validator`s.

```sh
nu <NAME>

Files generated:
/src/controllers/<NAME>/get/router.ts
/src/controllers/<NAME>/get/validator.ts
# remaining routers for other http verbs
/src/lib/<NAME>/repo.ts
/src/lib/<NAME>/service.ts
```

You can get access to this script by running the following:

```sh
chmod +x bin/nu.js && npm link
```

## Notes

This project utilizes [_stored procedures_](https://en.wikipedia.org/wiki/Stored_procedure)
(or "sprocs" for short). Stored procedures remove most, if
not all, compiling overhead from queries as they are stored
directly in the database. Because of this, `ObjectionJS`
and `Knex` cannot be used as there will be no need to
perform SQL queries from the API.

Instead, an `executeSproc` (or similarly named) function
will be called to execute a specific query.

Due to the nature of sprocs and using a production database,
tests may not be written for this project.

---
_Source: https://npm.io/package/equity-report-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
