Skip to content

Commit

Permalink
UI stuff (#6)
Browse files Browse the repository at this point in the history
* FEATURE: Added PassiveSearch v1

- Added Connection to ElasticSearch
- Added 2 API's - /ping and /passive
- Keyword Search using /passive
- Added Storing to DB capability when using /search

* Fix: Added error handling

-added error handling for passivesearch api endpoint

* FEATURE: Added Simple Query String

- Changed ElasticSearch Search type to Simple Query String

* REFACTOR: Improved Active Search

-Made Active Search make better use of downtimes (Rate Limits or Validation Downtime)

* FIX: Issues with Active Search

-Fixed errors with parrallel processing

* FEATURE: Added SeedScript

- Added RootQuery as an optional query param for activesearch which basically takes out the prompt builder and takes a raw query to look for in Github API.
- Added Python SeedScript

* REFACTOR: Changed Data Model for Storing in Database

- Added other fields like LastUpdated, ETAG, URL, LastModified to Schema.
- Added SHA hash as the unique parameter to not allow duplicates in the database

* REFACTOR: Minor Log Refactor

- Changed console.log to console.info / console.error

* FIX: Storing only the reqd part of URL

* FEATURE: Update API

-Added PUT /database endpoint for updating the database

- Changed name of the endpoints

- Commented Database Trace Logs

* FIX: Update API Fix + Global ElasticSearch and Octokit Clients

- Fixed GetFileContents
- Added Global variables for EsClient and Octokit for easy access and clean code
- Better logs

* FIX: Minor Comment

* REFACTOR: UpdateAPI refactor

- Update API Refactored

* REFACTOR: Minor Fixes

- Better API Naming
- Fixed Update API

* FIX: Fixed Seed Script

* FIX: reverting  '/' api

* FEATURE: Added Dockerfiles

-Added Dockerfile

* BUG: Minor Fixes

- Made tests work
- Added basic Admin Panel
- Did prettier leading to so many changes in this commit

* BUG: fixed tests

* UI Fixes

* UI Stuff
  • Loading branch information
ishaan812 committed Nov 5, 2023
1 parent 0db51e4 commit 22c18fc
Show file tree
Hide file tree
Showing 26 changed files with 4,544 additions and 395 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// examples, and because it is not a recommended rule, you should either
// disable it, or understand what it enforces.
// https://typescript-eslint.io/rules/explicit-function-return-type/
"@typescript-eslint/explicit-function-return-type": "warn"
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-explicit-any": "off"
}
}
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: [jsynowiec]
github: [ishaan812]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
- uses: volta-cli/action@v1
- run: npm ci --no-audit
- run: npm run lint --if-present
- run: npm test
- run: npm run build --if-present
- run: npm run start --if-present
- run: npm run test --if-present
- run: npm test
env:
CI: true
15 changes: 9 additions & 6 deletions __tests__/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import request from 'supertest';
import app from '../src/app.js';
import axios from 'axios';

describe('Test app.ts', () => {
test('Catch-all route', async () => {
const res = request(app).get('/');
expect(res).toEqual('TypeScript With Express');
describe('API Tests', () => {
test('GET /', async () => {
const response = await axios.get('http://localhost:8080/');
expect(response.status).toBe(200);
});
test('GET /ping', async () => {
const response = await axios.get('http://localhost:8080/ping');
expect(response.status).toBe(200);
});
});
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
container_name: elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
ports:
- '9200:9200'
- '9300:9300'
volumes:
- esdata:/usr/share/elasticsearch/data

app:
build:
context: .
dockerfile: docker/Dockerfile
environment:
- PORT=${PORT}
- GITHUB_API_KEY=${GITHUB_API_KEY}
- ES_HOST=host.docker.internal
ports:
- '${PORT}:${PORT}'
depends_on:
- elasticsearch
links:
- elasticsearch

volumes:
esdata:
14 changes: 14 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:18-alpine

WORKDIR /usr

COPY ./package.json ./package-lock.json ./.prettierrc ./.eslintrc.json ./jest.config.js ./tsconfig.json ./tsconfig.release.json ./
RUN npm install

COPY ./src ./src

EXPOSE 8080

RUN npm run build
COPY ./src/templates ./build/src/templates
CMD ["npm", "run", "start"]
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default {
testEnvironment: 'node',
preset: 'ts-jest/presets/default-esm',
// setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],
preset: 'ts-jest',
transform: {
'^.+\\.m?[tj]s?$': ['ts-jest', { useESM: true }],
},
Expand Down
Loading

0 comments on commit 22c18fc

Please sign in to comment.