Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
dfd0bb2
NateMitts Oct 19, 2018
584fdec
Trimmed down the homework struct
Nov 27, 2018
ccdb2e6
NateMitts Nov 27, 2018
c82897c
Merge pull request #9 from SocialHW/DatabaseCreation
NateMitts Nov 27, 2018
7229776
Delete homeworkHub.db
NateMitts Dec 4, 2018
9156571
Delete homeworkHub.db
NateMitts Dec 4, 2018
31293a6
Update .gitignore
NateMitts Dec 4, 2018
918456e
Update .gitignore
NateMitts Dec 4, 2018
392db66
Added design artifacts from our Google Drive file, and updated README…
Dec 4, 2018
8f646f4
Delete post_tags.go
NateMitts Dec 4, 2018
0b08981
Merge remote-tracking branch 'origin/develop' into develop
Dec 4, 2018
5403354
Delete databaseSetAdmin.go
NateMitts Dec 4, 2018
e68fede
Delete databseCreateV2.go
NateMitts Dec 4, 2018
043b0e6
Delete userTestV2.go
NateMitts Dec 4, 2018
3ce288b
Merge remote-tracking branch 'origin/develop' into develop
Dec 4, 2018
b9b9682
Delete post_tags.go
NateMitts Dec 4, 2018
b554c76
Merge branch 'feature/documentation' into develop
Dec 4, 2018
eb5016a
Trimmed down Homework struct
Dec 4, 2018
dafd3ba
Removed unsed init scripts
Dec 4, 2018
4b2c09b
NateMitts Dec 5, 2018
75c4352
NateMitts Dec 5, 2018
a19d934
Created handler and models files based on Github example
Dec 5, 2018
8374150
NateMitts Dec 5, 2018
bc0fd8e
NateMitts Dec 5, 2018
c9efd12
NateMitts Dec 5, 2018
4022033
Added database variable
Dec 5, 2018
241651c
Merge branch 'DatabaseCreation' into feature/handlers
Dec 5, 2018
58ea0be
Moved all handler functions to handlers go file.
Dec 6, 2018
8c1fe66
Removed unnecessary field in User struct. Removed unnecessary if stat…
Dec 6, 2018
9cbbfc6
Removed unnecessary variables, reassigned to the same variable multip…
Dec 6, 2018
0cb9462
Merge pull request #11 from SocialHW/feature/handlers
Dec 6, 2018
b5de00e
Dynamically render the login/logout based on if the user is authentic…
Dec 6, 2018
f143af4
NateMitts Dec 6, 2018
38e9d78
Redirect logged in users to index
Dec 6, 2018
efbd7e6
Created login and register page.
Dec 6, 2018
ba06910
Merge branch 'develop' into feature/handlers
Dec 6, 2018
40a9a09
Moved register data handler to separate end point
Dec 6, 2018
6268a15
NateMitts Dec 6, 2018
20b1fc1
NateMitts Dec 6, 2018
f6d327f
For some reason the database had to be called .sqlite3. Perhaps this …
Dec 7, 2018
27690fc
Can create accounts!!!
Dec 7, 2018
363ef1a
Can create accounts!!! ... kind of
Dec 7, 2018
8aa5775
Can create accounts for real this time!!
Dec 7, 2018
df60abc
Reformated code
Dec 7, 2018
dfc6be0
Can upload files!
Dec 7, 2018
b496bd7
Can upload files with unique names
Dec 7, 2018
685ada8
Create files in the form of "id.ext"
Dec 7, 2018
7fefb2c
Removed old comment
Dec 7, 2018
b33daaa
Updated formatting
Dec 7, 2018
9a97ffe
Successfully storing all data related to post when uploading.
Dec 7, 2018
3117422
Can navigate to the id of the image at /h/#
Dec 7, 2018
b6b6fc8
Removed unneeded struct.
Dec 7, 2018
3453b48
Can view new posts on index page.
Dec 7, 2018
c57055e
Added username to posts on index page.
Dec 7, 2018
1a7c67e
Removed unneeded sidebar
Dec 7, 2018
ec04ea8
Can add comments and view them per each post.
Dec 7, 2018
fbb2ab4
Removed unused hardcoded image previously used to show as an example …
Dec 7, 2018
60402b4
Removed unneeded init scripts.
Dec 9, 2018
3302bf4
Fixed top bar on post page.
Dec 9, 2018
7fe1c85
Added upload button when logged in to the site
Dec 9, 2018
2d56c4c
Only prompt to add a comment when the user is logged in
Dec 9, 2018
52266e7
Updated individual post page.
Dec 9, 2018
8f663ac
Reformatted code. Added class to post container element.
Dec 9, 2018
2b28648
Made the styling from the index page to the individual post page.
Dec 10, 2018
1e2f662
Merge branch 'feature/styling' into develop
Dec 10, 2018
ccd9c40
Merge branch 'feature/templating' into develop
Dec 10, 2018
1dacdf2
Added username on post page
Dec 10, 2018
6cfd662
Added alert when login fails
Dec 10, 2018
648db11
Added container to login page along with top bar.
Dec 10, 2018
8513b31
Added specific errors for registering an account. Made the styling co…
Dec 10, 2018
b1d35d5
Merge branch 'release/1.0'
Dec 10, 2018
bd7cf6a
Merge tag '1.0' into develop
Dec 10, 2018
19984a6
Update README.md
Dec 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@
*.dll
*.so
*.dylib
*.db
*.sqlite3

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out


*.old

25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,31 @@ studying ability*

## Installing

To run this project, `golang-go` and `git` must be installed on your system. They can both be downloaded using the
command:
```bash
sudo apt install golang-go git -y
```

Download the source using the command:

```bash
git clone https://github.com/SocialHW/HomeworkHub.git
```

Installing the required dependencies to run (such as MySQL):

Running this project no longer requires any external dependencies to be running, such as MySQL. However, you must
install the third party libraries we are using for our cryptographic functions, and for interacting with our
SQLite3 database. To do so, run the command:
```bash
cd HomeworkHub/
sh init/init.sh
go get golang.org/x/crypto/bcrypt github.com/mattn/go-sqlite3
```

## Building and Running

The project depends on the existence of a local instance of MySQL running. To start MySQL after it is installed,
run the command:

```bash
sh init/start_db.sh
```

To run the project as a Go script, simply run this command from the root directory of the project:

```bash
go run main.go
go run *.go
```


Expand All @@ -56,4 +55,4 @@ git flow feature start <feature-name>
This will create a new branch named `feature/<feature-name>`, and checkout that branch so you can immediately start work
on it. When the feature is finished and you would like to merge, make sure you have commited and pushed all of your
changes, and head to GitHub where you can make a new pull request for that feature. Make sure to merge into the develop
branch.
branch.
13 changes: 13 additions & 0 deletions db/comment_section.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func main() {
database, _ := sql.Open("sqlite3", "./db.sqlite3")
statement, _ := database.Prepare("CREATE TABLE IF NOT EXISTS comment_section (post_id INTEGER, username TEXT, comment TEXT)")
statement.Exec()
}
28 changes: 0 additions & 28 deletions db/databaseSetAdmin.go

This file was deleted.

32 changes: 0 additions & 32 deletions db/databseCreate.go

This file was deleted.

32 changes: 0 additions & 32 deletions db/databseCreateV2.go

This file was deleted.

13 changes: 13 additions & 0 deletions db/post_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func main() {
database, _ := sql.Open("sqlite3", "./db.sqlite3")
statement, _ := database.Prepare("CREATE TABLE IF NOT EXISTS post_info (post_id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, title TEXT, file_path TEXT)")
statement.Exec()
}
48 changes: 0 additions & 48 deletions db/userTest.go

This file was deleted.

52 changes: 0 additions & 52 deletions db/userTestV2.go

This file was deleted.

13 changes: 13 additions & 0 deletions db/user_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func main() {
database, _ := sql.Open("sqlite3", "./db.sqlite3")
statement, _ := database.Prepare("CREATE TABLE IF NOT EXISTS userInfo (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT)")
statement.Exec()
}
16 changes: 16 additions & 0 deletions design_artifacts/account-creation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###Account Creation

Users will be able to create an account by clicking a link in the top right corner of
the home page with the text "Register". The link will direct the user to /register where
they can provide a username, and a password. They submit the request to create an
account by pressing a button labeled "Create Account". If the username is not taken, they
will be redirected to the index page. From there they can continue to login by clicking
a link in the top right corner with the text "Login". From there they can enter the
username and password they provided before. They will be redirected to the index page,
where they will now be logged in.

When the user clicks on the Create Account button, they will be submitting an HTTP POST
request, to /register/details with the information they provided. There will be a
handler function listening on /register/details which will query the user info table
to find an account with a matching username. If there is no account with a matching
username, the account can be created by inserting a new row into the database.
13 changes: 13 additions & 0 deletions design_artifacts/database_communication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
###Database Communication

We should have a file at the db directory of the project that contains all of the functions needed to interact with the
database.
* There should be a RegisterUser function that will take the email and password as strings, and executes the queries to
insert the user into the database if it is a valid registration.
* There should be a LoginUser function that will take a username and password as strings, query the database to for the
password associated with the username entered. If the username exists and the password entered is equal to the password
in the database, the user is redirected to the home page.
* There should be a GetPosts function that takes a predicate function (of Post -> Boolean) and returns []Post,
containing the Posts in the database that meet the predicate. Future implementations may use a comparator function to
rank the results, such as closest search result match.
* There should be a CreatePost function, that takes a Post struct and inserts all of its fields into.
20 changes: 20 additions & 0 deletions design_artifacts/database_design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
###Database Structure

SQLite uses a .db file to represent the database. We should have some .db file located in the db directory. This file
will contain all of the tables we use to store information related to the site.
___

There should be a Posts table with the following columns:

post_id primary key, auto inc INTEGER | username TEXT | title TEXT | extension TEXT
___

There should be a Comments table with the following columns:

post_id INTEGER | username TEXT | comment TEXT
___

There should be a user info table with the following columns:

ID primary key, auto inc INTEGER | Username TEXT | password TEXT
___
5 changes: 5 additions & 0 deletions design_artifacts/feedback_mechanism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
###Feedback Mechanism

We were planning on creating some sort of rating system in order to show users more
relevant and higher quality results. We have since abandoned this idea for the sake of
time.
13 changes: 13 additions & 0 deletions design_artifacts/file_uploading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
###File Uploading

Uploading images to the site represent the core value of the project. Users will have the ability to upload jpg/jpeg,
png, gif, and pdf files to be stored on the site. There will be a maximum upload size of 8MB in order to restrict users
from overusing the resources of the web server. Each file will be associated with a post, which is a row in the Posts
table containing information such as the user who created the post, the title, and the extension of the file. The file
will be saved in the location "posts/<postid>.<ext>". Since each post will have a unique ID, this will prevent
collisions when storing files on the disk.

In order to create a new post, a user must be logged in and will click a link in the top right corner of the web page.
The user will be redirected to /create-post, where they will be prompted for the information required for a new post.

It should not be allowed to use punctuation such as ;, in order to avoid SQL injection.
9 changes: 9 additions & 0 deletions design_artifacts/post_searching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
###Post Searching

In order to aid users in navigating the site, we will provide a searching feature. There
will be a text box located in the header of the page, where users (who do not need to be
logged in) can enter a string of text and hit enter to see the results. The search will
return results that include any of the words in the query in the title, and present
them in a vertical listing.

It should not be allowed to use punctuation such as ;, in order to avoid SQL injection.
Loading