Skip to content

Commit

Permalink
Merge pull request #111 from Open-Cap-Stack/feature/financial-control…
Browse files Browse the repository at this point in the history
…ler-api

WIP:Compliance API testing
  • Loading branch information
urbantech authored Nov 20, 2024
2 parents 99234e8 + c99bc8e commit 6ab0b1a
Show file tree
Hide file tree
Showing 48 changed files with 3,726 additions and 1,238 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"python.analysis.extraPaths": [
"./dags/test_",
"./dags/test_"
]
}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Use Node.js as the base image
FROM node:18

# Set the working directory inside the container
WORKDIR /app

# Copy package files and install dependencies
COPY package*.json ./
RUN npm install

# Copy the rest of the application code
COPY . .

# Expose the app's running port
EXPOSE 3000

# Command to run the app
CMD ["npm", "start"]

24 changes: 24 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use Node.js LTS image
FROM node:18

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json to leverage Docker cache
COPY package*.json ./

# Install all dependencies (including dev dependencies)
RUN npm install

# Install nodemon globally for live reload
RUN npm install -g nodemon

# Copy application source code
COPY . .

# Expose the app's running port
EXPOSE 3000

# Use nodemon for live reload in development
CMD ["nodemon", "app.js"]

68 changes: 40 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Follow these steps to set up the project on your local machine:

### Prerequisites ✅

- Node.js (v14 or higher)
- Node (v14 or higher)
- MongoDB

### Clone the Repository 📂
Expand All @@ -26,14 +26,16 @@ npm install

### Set Up Environment Variables 🔐

Create a `.env` file in the root of the project and add the following environment variables:
## Environment Variables

Create a `.env` file in the root directory and add the following:

```bash
MONGODB_URI=mongodb://localhost:27017/opencap
MONGODB_URI=mongodb://mongo:27017/opencap
PORT=5000
```

Replace `mongodb://localhost:27017/opencap` with your MongoDB connection string if it's different.
Replace `mongodb://mongo:27017/opencap` with your MongoDB connection string if it's different.

## Running the Project ▶️

Expand All @@ -45,7 +47,7 @@ npm start

This command starts the server on [http://localhost:5000](http://localhost:5000).

### Start the Development Server with Nodemon 🔄
### Start the Development Server 🔄

For automatic restarts on code changes, use:

Expand All @@ -68,67 +70,76 @@ This command runs all the test cases defined in the `tests` directory.
Here are the primary API endpoints for the project:

### Users 👤

- **POST /api/users**: Create a new user
- **GET /api/users**: Get all users
- **GET /api/users/:id**: Get a user by ID
- **PUT /api/users/:id**: Update a user by ID
- **DELETE /api/users/:id**: Delete a user by ID

### Stakeholders 👥

- **POST /api/stakeholders**: Create a new stakeholder
- **GET /api/stakeholders**: Get all stakeholders
- **GET /api/stakeholders/:id**: Get a stakeholder by ID
- **PUT /api/stakeholders/:id**: Update a stakeholder by ID
- **DELETE /api/stakeholders/:id**: Delete a stakeholder by ID

### Share Classes 🏦
- **POST /api/shareclasses**: Create a new share class
- **GET /api/shareclasses**: Get all share classes
- **GET /api/shareclasses/:id**: Get a share class by ID
- **PUT /api/shareclasses/:id**: Update a share class by ID
- **DELETE /api/shareclasses/:id**: Delete a share class by ID

- **POST /api/share-classes**: Create a new share class
- **GET /api/share-classes**: Get all share classes
- **GET /api/share-classes/:id**: Get a share class by ID
- **PUT /api/share-classes/:id**: Update a share class by ID
- **DELETE /api/share-classes/:id**: Delete a share class by ID

### Documents 📄

- **POST /api/documents**: Create a new document
- **GET /api/documents**: Get all documents
- **GET /api/documents/:id**: Get a document by ID
- **PUT /api/documents/:id**: Update a document by ID
- **DELETE /api/documents/:id**: Delete a document by ID

### Activities 📋

- **POST /api/activities**: Create a new activity
- **GET /api/activities**: Get all activities
- **GET /api/activities/:id**: Get an activity by ID
- **PUT /api/activities/:id**: Update an activity by ID
- **DELETE /api/activities/:id**: Delete an activity by ID

### Notifications 🔔

- **POST /api/notifications**: Create a new notification
- **GET /api/notifications**: Get all notifications
- **GET /api/notifications/:id**: Get a notification by ID
- **PUT /api/notifications/:id**: Update a notification by ID
- **DELETE /api/notifications/:id**: Delete a notification by ID

### Equity Simulations 📊
- **POST /api/equitysimulations**: Create a new equity simulation
- **GET /api/equitysimulations**: Get all equity simulations
- **GET /api/equitysimulations/:id**: Get an equity simulation by ID
- **PUT /api/equitysimulations/:id**: Update an equity simulation by ID
- **DELETE /api/equitysimulations/:id**: Delete an equity simulation by ID

- **POST /api/equity-simulations**: Create a new equity simulation
- **GET /api/equity-simulations**: Get all equity simulations
- **GET /api/equity-simulations/:id**: Get an equity simulation by ID
- **PUT /api/equity-simulations/:id**: Update an equity simulation by ID
- **DELETE /api/equity-simulations/:id**: Delete an equity simulation by ID

### Tax Calculations 💰
- **POST /api/taxcalculations**: Create a new tax calculation
- **GET /api/taxcalculations**: Get all tax calculations
- **GET /api/taxcalculations/:id**: Get a tax calculation by ID
- **PUT /api/taxcalculations/:id**: Update a tax calculation by ID
- **DELETE /api/taxcalculations/:id**: Delete a tax calculation by ID

- **POST /api/tax-calculations**: Create a new tax calculation
- **GET /api/tax-calculations**: Get all tax calculations
- **GET /api/tax-calculations/:id**: Get a tax calculation by ID
- **PUT /api/tax-calculations/:id**: Update a tax calculation by ID
- **DELETE /api/tax-calculations/:id**: Delete a tax calculation by ID

### Financial Reporting 📈
- **POST /api/financialreports**: Create a new financial report
- **GET /api/financialreports**: Get all financial reports
- **GET /api/financialreports/:id**: Get a financial report by ID
- **PUT /api/financialreports/:id**: Update a financial report by ID
- **DELETE /api/financialreports/:id**: Delete a financial report by ID

- **POST /api/financial-reports**: Create a new financial report
- **GET /api/financial-reports**: Get all financial reports
- **GET /api/financial-reports/:id**: Get a financial report by ID
- **PUT /api/financial-reports/:id**: Update a financial report by ID
- **DELETE /api/financial-reports/:id**: Delete a financial report by ID

## Project Structure 🗂️

Expand Down Expand Up @@ -262,14 +273,15 @@ Please follow these coding standards to maintain code quality and consistency:
-

Provide meaningful comments for complex code segments and functions.
- Document any public APIs and classes with clear explanations of their purpose and usage.
- Remove or update outdated comments as code changes.

- Document any public APIs and classes with clear explanations of their purpose and usage.
- Remove or update outdated comments as code changes.

- **Code Structure**:
- Organize code into modules and components.
- Keep functions small and focused on a single task.

- **Linting**: Ensure your code passes ESLint checks:
- **Lint**: Ensure your code passes ESLint checks:

```bash
npm run lint
Expand Down
5 changes: 2 additions & 3 deletions __tests__/CompanyController.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// test/CompanyController.test.js
const request = require('supertest');
const express = require('express');
const mongoose = require('mongoose');
Expand All @@ -10,7 +9,7 @@ jest.mock('../models/Company');

const app = express();
app.use(express.json());
app.use("/api/companies", require("../routes/Company"));
app.use("/api/companies", require("../routes/companyRoutes")); // Corrected file name

describe('Company Controller', () => {
beforeEach(() => {
Expand All @@ -25,7 +24,7 @@ describe('Company Controller', () => {
CompanyType: 'corporation',
RegisteredAddress: '456 New Avenue, New City, NC',
TaxID: '987-65-4321',
corporationDate: new Date().toISOString(), // Ensure date is in ISO string format
corporationDate: new Date().toISOString(),
};

Company.prototype.save.mockResolvedValue(companyData);
Expand Down
Loading

0 comments on commit 6ab0b1a

Please sign in to comment.