Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-classroom[bot] authored Oct 21, 2024
0 parents commit beafa8e
Show file tree
Hide file tree
Showing 133 changed files with 34,877 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
63 changes: 63 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: FakeStackOverflow CI
on: # Controls when the action will run.
# Triggers the workflow on push or pull request events but only for the master branch. If you want to trigger the action on other branches, add here
push:
branches: [main]
pull_request:
branches: [main]

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

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-and-test: #
# The type of runner that the job will run on
runs-on: ubuntu-20.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Launch MongoDB Server
uses: supercharge/[email protected]
with:
mongodb-version: "7.0"

- name: Build and lint frontend
if: ${{ always() }}
env:
REACT_APP_SERVER_URL: http://localhost:8000
run: cd client; npm i && npm run build && npm run lint

- name: Build backend service
if: ${{ always() }}
run: cd server; npm i

- name: Test backend server
if: ${{ always() }}
env:
# Pass the environmental variables for the backend tests to use
MONGODB_URI: mongodb://localhost:27017
run: |
cd server
npm run start & sleep 10
echo "Checking if the server is running..."
curl --fail 'http://localhost:8000/question/getQuestion?order=newest&search=' || (echo "Server failed to start" && killall node && exit 1)
echo "Server started successfully. Now stopping..."
killall node
npm run test
- name: Lint backend
if: ${{ always() }}
run: cd server; npm run lint
110 changes: 110 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

server/node_modules/
server/package-lock.json
.stryker-tmp/
server/reports

28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, neu-cs4530

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The individual and team project for this class are designed to mirror the experiences of a software engineer joining a new development team: you will be “onboarded” to our codebase, make several individual contributions, and then form a team to propose, develop and implement new features. The codebase that we’ll be developing on is a Fake Stack Overflow project (let’s call it HuskyFlow). You will get an opportunity to work with the starter code which provides basic skeleton for the app and then additional features will be proposed and implemented by you! All implementation will take place in the TypeScript programming language, using React for the user interface.

Refer to the [Project Overview](https://neu-se.github.io/CS4530-Fall-2024/assignments/project-overview) for more instructions on the project deliverables and expectations.

{ : .note } Refer to [IP1](https://neu-se.github.io/CS4530-Fall-2024/assignments/ip1) and [IP2](https://neu-se.github.io/CS4530-Fall-2024/assignments/ip2) for instructions related to setting up MongoDB, setting environment variables, and running the client and server.

{ : .note } The fields of the Schemas were changed. As a result, features such as view counts will not work on database entries that were made in IP1 and IP2. If you want to test features, delete old database entries and make new questions either through manually making it in the client or run populate_db.ts.

## Database Architecture

The schemas for the database are documented in the directory `server/models/schema`.
A class diagram for the schema definition is shown below:

![Class Diagram](class-diagram.png)
Binary file added class-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
module.exports = {
plugins: ['prettier', 'react', 'import'],
root: true,
env: {
browser: true, // Browser global variables like `window` etc.
commonjs: true, // CommonJS global variables and CommonJS scoping.Allows require, exports and module.
es6: true, // Enable all ECMAScript 6 features except for modules.
jest: true, // Jest global variables like `it` etc.
node: true, // Defines things like process.env when generating through node
},
extends: [
'airbnb-base',
'airbnb-typescript',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
],
settings: {
react: {
version: 'detect', // Detect react version
},
},
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false,
},
ignorePatterns: ['/*.*', '*.js'],
rules: {
'prettier/prettier': 'error',
'no-underscore-dangle': 0,
'no-param-reassign': 0,
'no-restricted-syntax': 0,
'react/react-in-jsx-scope': 'off',
'no-plusplus': 0,
'class-methods-use-this': 0,
'@typescript-eslint/no-throw-literal': 0,
'@typescript-eslint/lines-between-class-members': 0,
'@typescript-eslint/no-unused-vars': [1, { args: 'none' }],
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.spec.ts'] }],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
format: ['camelCase'],
},
{
selector: 'variable',
types: ['function'],
format: ['camelCase', 'PascalCase'],
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'variable',
format: ['camelCase'],
filter: {
regex: '^use[A-Z].*',
match: true,
},
},
{
selector: 'variable',
format: ['PascalCase'],
filter: {
regex: 'Context$',
match: true,
},
},
{
selector: 'variable',
modifiers: ['global', 'const'],
types: ['boolean', 'number', 'string', 'array'],
format: ['UPPER_CASE'],
},
{
selector: 'memberLike',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
],
},
};
23 changes: 23 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
16 changes: 16 additions & 0 deletions client/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
printWidth: 100,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
quoteProps: 'consistent',
jsxSingleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
jsxBracketSameLine: true,
arrowParens: 'avoid',
proseWrap: 'always',
htmlWhitespaceSensitivity: 'ignore',
endOfLine: 'lf',
};
Loading

0 comments on commit beafa8e

Please sign in to comment.