Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelim01 committed Sep 27, 2024
2 parents dfa5d44 + 154b802 commit 7450fca
Show file tree
Hide file tree
Showing 68 changed files with 24,024 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a sample environment configuration file.
# Copy this file to .env and replace the placeholder values with your own.
QUESTION_DB_CLOUD_URI=<FILL-THIS-IN>
QUESTION_DB_LOCAL_URI=mongodb://question-db:27017/question
QUESTION_DB_USERNAME=user
QUESTION_DB_PASSWORD=password

NODE_ENV=development
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Description

Please include a summary of the changes made in this pull request.

## Checklist

- [ ] I have updated documentation
- [ ] All tests passing

## Screenshots (if applicable)
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## https://docs.github.com/en/actions
name: CI

# Controls when the workflow will run
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
types: [ 'opened', 'reopened', 'synchronize']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
node-version: '20.x'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-service:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
service: [frontend, services/question]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
- name: Install Node Modules
run: cd ${{ matrix.service }} && npm ci
- name: Linting
run: cd ${{ matrix.service }} && npm run lint
- name: Build App
run: cd ${{ matrix.service }} && npm run build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore IntelliJ IDEA project files
.idea/
.env
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/bzPrOe11)
# CS3219 Project (PeerPrep) - AY2425S1
## Group: Gxx
## Group: G03

### Note:
- You can choose to develop individual microservices within separate folders within this repository **OR** use individual repositories (all public) for each microservice.
- In the latter scenario, you should enable sub-modules on this GitHub classroom repository to manage the development/deployment **AND** add your mentor to the individual repositories as a collaborator.
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
56 changes: 56 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
services:
frontend:
container_name: frontend
image: frontend
build:
context: frontend
dockerfile: Dockerfile
ports:
- 4200:4200
volumes:
- /app/node_modules
- ./frontend:/app
networks:
- question-network

question:
container_name: question
image: question
build:
context: services/question
dockerfile: Dockerfile
ports:
- 8081:8081
environment:
DB_CLOUD_URI: ${QUESTION_DB_CLOUD_URI}
DB_LOCAL_URI: ${QUESTION_DB_LOCAL_URI}
DB_USERNAME: ${QUESTION_DB_USERNAME}
DB_PASSWORD: ${QUESTION_DB_PASSWORD}
volumes:
- /app/node_modules
- ./services/question:/app
networks:
- question-network
- question-db-network

question-db:
container_name: question-db
image: mongo:7.0.14
environment:
MONGO_INITDB_ROOT_USERNAME: ${QUESTION_DB_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${QUESTION_DB_PASSWORD}
volumes:
- question-db:/data/db
- ./services/question/init-mongo/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js
networks:
- question-db-network
restart: always

volumes:
question-db:

networks:
question-network:
driver: bridge
question-db-network:
driver: bridge
16 changes: 16 additions & 0 deletions frontend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
38 changes: 38 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
39 changes: 39 additions & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db

package.json
package-lock.json
11 changes: 11 additions & 0 deletions frontend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tabWidth": 4,
"useTabs": false,
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"trailingComma": "all",
"bracketSameLine": true,
"printWidth": 120
}
10 changes: 10 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:20-alpine

WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
RUN npm install -g @angular/cli@18.0.0
COPY . .
EXPOSE 4200

CMD ["ng", "serve", "--host", "0.0.0.0"]
31 changes: 31 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Frontend

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.2.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Lint

Run `ng lint` to lint the project files. The linting rules can be configured in `.prettierrc.json` and `eslint.config.js`. You can use `ng lint --fix` to auto-fix linting issues where possible.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
111 changes: 111 additions & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"frontend": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/frontend",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "frontend:build:production"
},
"development": {
"buildTarget": "frontend:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"cli": {
"schematicCollections": [
"@angular-eslint/schematics"
],
"analytics": false
}
}
Loading

0 comments on commit 7450fca

Please sign in to comment.