Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

全端開發robert-ou組 #389

Open
wants to merge 248 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
248 commits
Select commit Hold shift + click to select a range
2acdfb1
feature: create model
RobertOu0213 Aug 22, 2023
976a168
Merge pull request #1 from tingul4/feature/model
tingul4 Aug 22, 2023
644ce14
feat: eslint files
tingul4 Aug 22, 2023
6560fd3
Merge pull request #3 from tingul4/develop
tingul4 Aug 22, 2023
7ec0941
add reply, tweet model
pupss91090 Aug 22, 2023
f5b93e3
feat: add account and cover in Users column
tingul4 Aug 22, 2023
c720963
Merge branch with develop
pupss91090 Aug 22, 2023
9aa764e
Merge branch 'develop' into modelcreate_tweet_reply
tingul4 Aug 22, 2023
aeed75b
Merge pull request #4 from tingul4/modelcreate_tweet_reply
tingul4 Aug 22, 2023
871b2c1
Merge branch 'develop'
pupss91090 Aug 22, 2023
65b24cb
feat: add admin seed file
tingul4 Aug 22, 2023
843969b
feat: add user seed file
tingul4 Aug 23, 2023
5746469
refactor: notation
RobertOu0213 Aug 23, 2023
8365e4e
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
RobertOu0213 Aug 23, 2023
3fc5f18
feat: add tweet seed file
tingul4 Aug 23, 2023
3a0952a
feat: add reply seed file
tingul4 Aug 23, 2023
6dadd59
init: routes&controllers
pupss91090 Aug 23, 2023
439772e
Merge pull request #6 from tingul4/init_routes/controllers
tingul4 Aug 23, 2023
3899abc
Merge pull request #5 from tingul4/feat/createSeeds
tingul4 Aug 23, 2023
b02433e
Merge branch 'feat/createSeeds' of https://github.com/tingul4/twitter…
RobertOu0213 Aug 23, 2023
5b9ba4d
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
RobertOu0213 Aug 23, 2023
56f356a
setting_app.js
RobertOu0213 Aug 23, 2023
98daf02
Merge pull request #7 from tingul4/develop
tingul4 Aug 23, 2023
d532831
feature: finish hbs setting
RobertOu0213 Aug 23, 2023
9062d6b
Merge pull request #8 from tingul4/feature/handlebars_setting
tingul4 Aug 23, 2023
6832746
feat: add auth middleware and helper and add passport
tingul4 Aug 23, 2023
782c3cc
feat: complete login MVC and add error handler
tingul4 Aug 23, 2023
78a0a47
feat: add check condition when signup
tingul4 Aug 23, 2023
7f3ab67
feat: finish tweet_view & side column button
RobertOu0213 Aug 23, 2023
98bc397
refactor: add css & icon
RobertOu0213 Aug 23, 2023
cb847eb
Merge pull request #10 from tingul4/feature/tweets_view
tingul4 Aug 23, 2023
c3b1dd2
fix: change parameter name to pass test
tingul4 Aug 23, 2023
6917945
Merge branch 'develop' into feat/userLogin
tingul4 Aug 24, 2023
36c5bbe
Merge pull request #9 from tingul4/feat/userLogin
tingul4 Aug 24, 2023
0294001
feat: complete edit page and edit data successfully but still not pas…
tingul4 Aug 24, 2023
14a2d4d
Merge branch 'feat/editInfo' of https://github.com/tingul4/twitter-fu…
tingul4 Aug 24, 2023
2f58007
feat: change some condition when edit info but still not pass test
tingul4 Aug 24, 2023
b825ca7
feat: complete admin login and pass test
tingul4 Aug 24, 2023
6613c4a
feat:finish reply tweet modal
RobertOu0213 Aug 24, 2023
f51c4d0
Merge pull request #11 from tingul4/feature/reply_modal
tingul4 Aug 24, 2023
2ac0357
refactor: use async await style
tingul4 Aug 24, 2023
f2a623c
refactor: make code shorter
tingul4 Aug 24, 2023
37f5dfc
Merge pull request #12 from tingul4/develop
tingul4 Aug 24, 2023
d323db3
docs: add Procfile
tingul4 Aug 24, 2023
d075c7e
feat: modify config for heroku
tingul4 Aug 24, 2023
e044de5
fix: add authenticate in tweet route
tingul4 Aug 24, 2023
f615a5d
fix
pupss91090 Aug 25, 2023
6ba6d8c
feat: update view of admin signin page
tingul4 Aug 25, 2023
fd68c1c
Merge pull request #13 from tingul4/feat/adminLogin
RobertOu0213 Aug 25, 2023
7ae9296
feat: update signin and signup views
tingul4 Aug 25, 2023
2acecf7
Merge branch 'develop'
pupss91090 Aug 25, 2023
9a20e07
Merge pull request #14 from tingul4/feat/loginView
RobertOu0213 Aug 25, 2023
c00331a
Merge pull request #15 from tingul4/develop
tingul4 Aug 25, 2023
119f194
Merge branch 'master' of https://github.com/tingul4/twitter-fullstack…
tingul4 Aug 25, 2023
363451e
tweets.hbs align
pupss91090 Aug 25, 2023
b328736
add users/tweets.hbs
pupss91090 Aug 25, 2023
798b0ec
feat: init admin page
tingul4 Aug 25, 2023
5695f3a
Merge branch 'view/frontpage' of https://github.com/tingul4/twitter-f…
tingul4 Aug 25, 2023
399a2b6
Merge pull request #16 from tingul4/view/frontpage
tingul4 Aug 25, 2023
22c6ec1
feat: display and delete tweets controller
tingul4 Aug 25, 2023
97b6fd2
Merge pull request #17 from tingul4/master
tingul4 Aug 25, 2023
7e21236
import userController into routes/index.js
pupss91090 Aug 25, 2023
a4864d0
merge
pupss91090 Aug 25, 2023
1575396
feat: complete edit page and edit data successfully but still not pas…
tingul4 Aug 24, 2023
4415f60
add handlebarhelper, add user tweet page tabs
pupss91090 Aug 25, 2023
c2b17f0
Merge branch 'view/frontpage'
pupss91090 Aug 25, 2023
2725119
fix signin/signup page view
pupss91090 Aug 25, 2023
31d3af7
fix: fix migration, model and seed file
tingul4 Aug 25, 2023
92073b2
Merge pull request #18 from tingul4/view/frontpage
tingul4 Aug 25, 2023
8cf9237
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 26, 2023
8e8ff52
feat: complete admin tweets page
tingul4 Aug 26, 2023
a22e09d
userpage_tweet/reply/like
pupss91090 Aug 26, 2023
beb345a
add addFollowing/removeFollowing function
pupss91090 Aug 26, 2023
c19d2d4
Merge pull request #19 from tingul4/view/frontpage
tingul4 Aug 26, 2023
a73faa8
refactor: change way to check if same user
tingul4 Aug 26, 2023
ff41bf8
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 26, 2023
a50a7c3
docs: add handlebars-helper
tingul4 Aug 26, 2023
fbf6b2b
Merge branch 'feat/adminPages' of https://github.com/tingul4/twitter-…
tingul4 Aug 26, 2023
eda8fe8
Merge pull request #20 from tingul4/feat/adminPages
pupss91090 Aug 26, 2023
aaf0d52
routes adjust
pupss91090 Aug 26, 2023
144f915
merge
pupss91090 Aug 26, 2023
4809e82
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 26, 2023
0ca93c3
feat: update edit view
tingul4 Aug 26, 2023
bddeda3
Merge branch 'develop' into feat/editInfo
tingul4 Aug 26, 2023
e901398
Merge pull request #21 from tingul4/feat/editInfo
pupss91090 Aug 26, 2023
8a29e91
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 26, 2023
1237565
adjust icon with status
pupss91090 Aug 26, 2023
87594ed
feat: tweet_reply controller
RobertOu0213 Aug 26, 2023
52daf1c
feat: admin users
tingul4 Aug 26, 2023
cf359a2
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 26, 2023
6f3f5ff
Merge pull request #23 from tingul4/feat/controller
tingul4 Aug 26, 2023
8d5867c
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 26, 2023
480b8f9
Merge pull request #22 from tingul4/edit/navigation
tingul4 Aug 26, 2023
c7e171c
fix: conflict bug
tingul4 Aug 26, 2023
685fcfd
Merge pull request #24 from tingul4/develop
tingul4 Aug 26, 2023
de7e7a4
Merge branch 'master' of https://github.com/tingul4/twitter-fullstack…
tingul4 Aug 26, 2023
7378453
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 27, 2023
7e05a12
feat: complete admin users view page
tingul4 Aug 27, 2023
b4f6f0d
feat: complete admin users but not pass test
tingul4 Aug 27, 2023
bb09029
feat: order by tweetCount and fix delete bug
tingul4 Aug 27, 2023
7c84c3d
feat: complete personal-modal view page
tingul4 Aug 27, 2023
e9f195a
feat: can upload cover and avatar
tingul4 Aug 27, 2023
761b86f
user/followerpage&user/followingpage function
pupss91090 Aug 27, 2023
739b477
userpage/partials adjust
pupss91090 Aug 27, 2023
630b1cc
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 27, 2023
3db47ea
Merge branch 'develop' into userpage/followingship
pupss91090 Aug 27, 2023
2cc9d27
Merge pull request #26 from tingul4/userpage/followingship
tingul4 Aug 27, 2023
726b23b
Merge pull request #25 from tingul4/feat/adminUsers
RobertOu0213 Aug 27, 2023
b29c46e
feat: refactor modal
RobertOu0213 Aug 27, 2023
428769e
feat: display user avatar
tingul4 Aug 27, 2023
47e0ccd
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 27, 2023
5bdf672
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 27, 2023
c34a08f
likepage controller
pupss91090 Aug 27, 2023
f7dd7b8
Merge pull request #27 from tingul4/refactor/modal
tingul4 Aug 27, 2023
884fc56
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 27, 2023
bd8784d
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 28, 2023
d0f5742
Merge branch 'master' into user/getlikepage
pupss91090 Aug 28, 2023
9dd4d73
feat: complete avatar display without background
tingul4 Aug 28, 2023
c802766
adjust user tweets page with like function
pupss91090 Aug 28, 2023
1baea78
Merge pull request #28 from tingul4/feat/uploadImage
RobertOu0213 Aug 28, 2023
b462a3d
refactor: count func
RobertOu0213 Aug 28, 2023
d5c41ef
fix like logic @user tweet page
pupss91090 Aug 28, 2023
8cd240c
fix like logic @user like page
pupss91090 Aug 28, 2023
fafdd2e
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 28, 2023
50bc7a4
remove find like model in user reply page
pupss91090 Aug 28, 2023
1e1cfe5
feat: add logo on title and link google font
tingul4 Aug 28, 2023
49d1f49
adjust logic in user following/follower page
pupss91090 Aug 28, 2023
5f0cd7b
adjust view in user following/follower page
pupss91090 Aug 28, 2023
bd8bb75
add reply modal in user pages
pupss91090 Aug 28, 2023
562fd6e
add navigation & top10user side columns
pupss91090 Aug 28, 2023
2fe1ccc
const reqUser in everypage for navigation
pupss91090 Aug 28, 2023
4ea1686
feat: adjust admin pages' view
tingul4 Aug 28, 2023
baa7eea
feat: modal error message
RobertOu0213 Aug 28, 2023
bf00d83
make tweet-card partial
pupss91090 Aug 28, 2023
cedb04b
add direct back on header icon
pupss91090 Aug 28, 2023
80be8a2
add tweet-card partial
pupss91090 Aug 28, 2023
c33fd6d
adjust user-page-tabs with status
pupss91090 Aug 28, 2023
6b55a97
adjust user-followpage-tabs with status
pupss91090 Aug 28, 2023
81c3082
make user-followpage-tweet-card.hbs
pupss91090 Aug 28, 2023
cfd0ecf
feat: adjust admin user card details
tingul4 Aug 28, 2023
dae81c4
Merge pull request #30 from tingul4/user/getlikepage
tingul4 Aug 28, 2023
3e5093a
Merge pull request #31 from tingul4/feat/viewDetails
RobertOu0213 Aug 28, 2023
52bef94
tweet card view adjust
pupss91090 Aug 28, 2023
526b5c5
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 28, 2023
e4746a0
Merge pull request #32 from tingul4/feat_add_count_func
pupss91090 Aug 28, 2023
5bdb9c4
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 28, 2023
cba08e1
top10 user add role user limit
pupss91090 Aug 28, 2023
1d70595
Merge pull request #33 from tingul4/align/frontpage_userpage
tingul4 Aug 28, 2023
8d8adf0
feat: side column for tweet& reply page
RobertOu0213 Aug 29, 2023
aed7b5b
feat: add CSS in error message
tingul4 Aug 29, 2023
b0f6dc0
feat: click avatar to another page
RobertOu0213 Aug 29, 2023
3881484
feat: add error message in auth and fix edit user bugs
tingul4 Aug 29, 2023
92615dd
align three-column layout & border
pupss91090 Aug 29, 2023
4343fef
modify partial icons folder
pupss91090 Aug 29, 2023
25d0ea8
modify partial contentcards&navs folder
pupss91090 Aug 29, 2023
6b31363
modify partial header
pupss91090 Aug 29, 2023
1ed85df
modify admin page layout
pupss91090 Aug 29, 2023
3d0b675
modify column icon
pupss91090 Aug 29, 2023
462ce27
modify follow function on userpage-info with status, modify controlle…
pupss91090 Aug 29, 2023
5e8445a
refactor: change req.user to helpers way
tingul4 Aug 29, 2023
30dd35c
feat: try
RobertOu0213 Aug 29, 2023
4d3c5b6
align avatar/cover defalut
pupss91090 Aug 29, 2023
e337460
Merge branch 'align/frontpage_userpage'
pupss91090 Aug 29, 2023
5084994
Merge pull request #34 from tingul4/align/frontpage_userpage
tingul4 Aug 29, 2023
94cd6c4
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 29, 2023
a881e7b
refactor: modal
RobertOu0213 Aug 29, 2023
499ab10
feat: align all views
tingul4 Aug 29, 2023
b21bb05
fix: revise parameter number
tingul4 Aug 29, 2023
9c44840
Merge pull request #35 from tingul4/feat/errorMessage
pupss91090 Aug 29, 2023
49985de
adjust tweet-card
pupss91090 Aug 29, 2023
d3b1d18
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 29, 2023
4f5383f
homepage layout
pupss91090 Aug 29, 2023
19859cd
partial reply icon
pupss91090 Aug 29, 2023
c530d05
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 29, 2023
741ebcc
reply card align
pupss91090 Aug 29, 2023
425c5b3
feat: avatar image
RobertOu0213 Aug 29, 2023
4971e55
refactor: avatar
RobertOu0213 Aug 29, 2023
b04dcfa
Merge branch 'develop' into feat/tweet_controller
tingul4 Aug 29, 2023
430bffa
Merge pull request #38 from tingul4/feat/tweet_controller
tingul4 Aug 29, 2023
8b8ecf9
fix: recover tweet.hbs
tingul4 Aug 29, 2023
d24fbf4
homepage layout
pupss91090 Aug 29, 2023
c0b6471
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 29, 2023
7307c81
align tweets&replies
pupss91090 Aug 29, 2023
b6d99a0
check all page have certain modals
pupss91090 Aug 29, 2023
ad2a396
Merge pull request #39 from tingul4/align/frontpage_userpage
tingul4 Aug 30, 2023
a02770b
fix: error messgaes and authentication
tingul4 Aug 30, 2023
1504d26
fix: login authentication
tingul4 Aug 30, 2023
649a5e0
fix: calculate liked number correctly
tingul4 Aug 30, 2023
aac99f3
finish modal error
RobertOu0213 Aug 30, 2023
6b9adc8
feat: 404 error page
RobertOu0213 Aug 30, 2023
923f2d5
refactor: pass test
RobertOu0213 Aug 30, 2023
2c3e01c
Merge pull request #40 from tingul4/refactor/modal_user
tingul4 Aug 30, 2023
818f42e
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 30, 2023
0a71c3d
refactor: follower only 10 people
RobertOu0213 Aug 30, 2023
1fe79d3
refactor:top-user-bar
RobertOu0213 Aug 30, 2023
207d548
feat: comment&reply success_msg
RobertOu0213 Aug 30, 2023
ee13bbf
feat: add form validation
tingul4 Aug 30, 2023
e88a058
Merge pull request #41 from tingul4/refactor_robert
tingul4 Aug 30, 2023
0205018
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 30, 2023
e6cac79
Merge pull request #42 from tingul4/fix/details
RobertOu0213 Aug 30, 2023
ea1eca9
modify follower/following page controller& hbs
pupss91090 Aug 30, 2023
0fd8fb7
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
pupss91090 Aug 30, 2023
76e53e5
Merge branch 'develop'
tingul4 Aug 30, 2023
83a012d
modify likes page view
pupss91090 Aug 30, 2023
b0ac4d8
modify followships page logic
pupss91090 Aug 30, 2023
005a7ff
remove extra tweet modal
pupss91090 Aug 30, 2023
70a45fd
modify for test file
pupss91090 Aug 31, 2023
51e4c09
Merge pull request #43 from tingul4/modify/followshippage
RobertOu0213 Aug 31, 2023
209deed
Merge branch 'modify/followshippage'
pupss91090 Aug 31, 2023
54d86f8
Merge pull request #44 from tingul4/modify/followshippage
tingul4 Aug 31, 2023
49c47c9
refactor modal form outline
RobertOu0213 Aug 31, 2023
ac3a19e
feat: add previewImage and rename error-msg
tingul4 Aug 31, 2023
37ca5b0
refactor: dynamic display input length
tingul4 Aug 31, 2023
571866f
fix: error auth and messages
tingul4 Aug 31, 2023
5642b56
fix: unnecessary auth
tingul4 Aug 31, 2023
7ecd6bf
Merge pull request #45 from tingul4/fix/details
RobertOu0213 Aug 31, 2023
cdc2ee2
fix: add:text-break & error_msg_js
RobertOu0213 Aug 31, 2023
aa75c4d
fix: addFollowing route
tingul4 Aug 31, 2023
eb5099f
fix: modal
RobertOu0213 Aug 31, 2023
70772f8
fix: modal
RobertOu0213 Aug 31, 2023
9f596eb
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 31, 2023
51e3cde
fix: rename error reply
tingul4 Aug 31, 2023
961c54b
Merge pull request #46 from tingul4/refactor/test
tingul4 Aug 31, 2023
ef218b2
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Aug 31, 2023
95e1b9e
fix: followships order
tingul4 Aug 31, 2023
88ae746
fix: add status code
tingul4 Aug 31, 2023
c105234
fix: login auth way
tingul4 Aug 31, 2023
e07c4e2
fix: followships order
tingul4 Aug 31, 2023
af6b6e2
fix: hint messages
tingul4 Aug 31, 2023
3a13a18
Merge pull request #47 from tingul4/fix/details
RobertOu0213 Sep 1, 2023
f17765f
Merge branch 'develop' of https://github.com/tingul4/twitter-fullstac…
tingul4 Sep 1, 2023
4c91535
fix: edit user
tingul4 Sep 1, 2023
2523d19
fix: add following
tingul4 Sep 1, 2023
ac25119
Merge pull request #48 from tingul4/fix/route
RobertOu0213 Sep 1, 2023
20384a5
fix: session secret
tingul4 Sep 1, 2023
c350563
fix: modal
RobertOu0213 Sep 1, 2023
6b94104
Merge pull request #49 from tingul4/fix/modal
tingul4 Sep 1, 2023
b4454e7
add readme.md
pupss91090 Sep 2, 2023
88b56cb
compress screenshot files
pupss91090 Sep 2, 2023
dae53d7
compress
pupss91090 Sep 2, 2023
d33e91e
Merge pull request #50 from tingul4/feat/readme
tingul4 Sep 2, 2023
c9e2749
docs: add .env.example
tingul4 Sep 2, 2023
db6965b
Merge pull request #51 from tingul4/docs
RobertOu0213 Sep 2, 2023
89fa426
fix: topuser_add slice(0, 10)
RobertOu0213 Sep 3, 2023
d2eeab1
fix: users_likes.hbs & user-controller_getUserLikesPage
RobertOu0213 Sep 3, 2023
66bc3a5
Merge pull request #53 from tingul4/fix/topuser
tingul4 Sep 3, 2023
1f71526
Merge pull request #54 from tingul4/fix/getUserLikesPage
tingul4 Sep 3, 2023
dc8b915
Update README.md
pupss91090 Nov 8, 2023
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IMGUR_CLIENT_ID=<your IMGUR_CLIENT_ID>
12 changes: 12 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
env:
browser: true
commonjs: true
es2021: true
extends:
- standard
parserOptions:
ecmaVersion: 12
rules:
arrow-parens:
- warn
- as-needed
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@ typings/
.fusebox/

# DynamoDB Local files
.dynamodb/
.dynamodb/

temp/
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: NODE_ENV=production node app.js
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Alphitter

Alphitter是一個簡易的twitter社群互動網站,提供使用者在註冊登入後,透過線上發文、留言、拜訪其他使用者主頁、追蹤其他使用者來建立朋友圈。

## 功能說明

- 提供前台個人帳號註冊、登入,帳號及Email不可重複註冊,帳號密碼及Email註冊後可再自行修改
- 可編輯暱稱、個人頭像、個人主頁首圖及自我介紹以展現個人風格
- 發布貼文、瀏覽全站貼文做出回覆及like
- 可追蹤其他使用者,可瀏覽全站粉絲最多的熱門使用者清單
- 透過點選頭像可以進入個別使用者主頁,在主頁除能看到該使用者的個人公開資訊,也能一次瀏覽該使用者的所有貼文、已做出的留言回覆、like過的貼文,以及其追蹤者及追蹤清單

## 安裝與執行

1. 安裝node.js and npm
2. 複製專案到本機
```
git clone https://github.com/tingul4/twitter-fullstack-2023.git
```
3. 進入專案資料夾
```
cd twitter-fullstack-2023
```
4. 安裝套件
```
npm install
```
5. 在MySQL Workbench中分別建立開發/測試兩個資料庫
>create database ac_twitter_workspace;
>
>create database ac_twitter_workspace_test;

6. 切換環境(開發/測試),並請確認當前切換至開發環境

*切換至開發環境*
```
export NODE_ENV=development
```
*切換至測試環境*
```
export NODE_ENV=test
```
*確認當前環境*
```
echo $NODE_ENV
```
7. 執行資料庫及建立種子資料
```
npx sequelize db:migrate
npx sequelize db:seed:all
```
8. 啟動專案
```
npm run dev
```

9. 看到以下訊息,可至瀏覽器輸入網址開啟 `http://localhost:3000/`
```
Example app listening on port 3000!
```
10. 登入種子帳號

*前台*
> email: '[email protected]' password: '12345678'
>
> email: '[email protected]' password: '12345678'
>
> email: '[email protected]' password: '12345678'
>
> email: '[email protected]' password: '12345678'
>
> email: '[email protected]' password: '12345678'

*後台*
> email: '[email protected]' password: '12345678'

或註冊前台帳號,登入後即可開始twitter社群互動

*後台帳號需由開發人員在資料庫中手動建立*

## 畫面截圖

### 帳號註冊、登入
![s_01](./screenshoots/s_01.png)

![s_02](./screenshoots/s_02.png)

### 首頁:全站貼文、發文視窗
![s_03](./screenshoots/s_03.png)

![s_04](./screenshoots/s_04.png)

### 個人主頁、編輯個人資訊
![s_05](./screenshoots/s_05.png)
![s_06](./screenshoots/s_06.png)

### 瀏覽他人主頁
![s_07](./screenshoots/s_07.png)

### 瀏覽貼文細節、回覆貼文
![s_08](./screenshoots/s_08.png)
![s_09](./screenshoots/s_09.png)

### 追蹤功能、追蹤頁、被追蹤頁
![s_10](./screenshoots/s_10.png)
![s_11](./screenshoots/s_11.png)

### 編輯帳號資料
![s_12](./screenshoots/s_12.png)

### 後台管理員登入、推文清單管理、使用者列表
![s_13](./screenshoots/s_13.png)
![s_14](./screenshoots/s_14.png)
![s_15](./screenshoots/s_15.png)
![s_16](./screenshoots/s_16.png)


## 開發工具

- Express - The framework used
- MySQL - Database
- Heroku - Where API hosted


## 開發人員

- Daniel Chen https://github.com/tingul4
- Robert Ou https://github.com/RobertOu0213
- Jessica Hsu https://github.com/pupss91090
12 changes: 6 additions & 6 deletions _helpers.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function ensureAuthenticated(req) {
return req.isAuthenticated();
function ensureAuthenticated (req) {
return req.isAuthenticated()
}

function getUser(req) {
return req.user;
function getUser (req) {
return req.user
}

module.exports = {
ensureAuthenticated,
getUser,
};
getUser
}
37 changes: 31 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
const express = require('express')
const helpers = require('./_helpers');
const routes = require('./routes')
const handlebars = require('express-handlebars')
const flash = require('connect-flash')
const methodOverride = require('method-override')
const session = require('express-session')
const passport = require('./config/passport')
const helpers = require('./_helpers')
const handlebarsHelpers = require('./helpers/handlebars-helpers')
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config()
}

const app = express()
const port = 3000
const port = process.env.PORT || 3000

// use helpers.getUser(req) to replace req.user
// use helpers.ensureAuthenticated(req) to replace req.isAuthenticated()
app.engine('hbs', handlebars({ extname: '.hbs', helpers: handlebarsHelpers }))
app.set('view engine', 'hbs')
app.use(express.static('public'))
app.use(express.urlencoded({ extended: true }))
app.use(flash())
app.use(methodOverride('_method'))
app.use(session({ secret: 'SESSION_SECRET', resave: false, saveUninitialized: false }))
app.use(passport.initialize())
app.use(passport.session())
app.use((req, res, next) => {
res.locals.success_messages = req.flash('success_messages')
res.locals.error_messages = req.flash('error_messages')
res.locals.user = helpers.getUser(req)
next()
})
app.use(routes)

app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
app.listen(port, () => {
console.info(`Example app listening on port ${port}!`)
})

module.exports = app
6 changes: 1 addition & 5 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
"logging": false
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"host": "127.0.0.1",
"dialect": "mysql"
"use_env_variable": "MYSQL_DATABASE_URL"
},
"travis": {
"username": "travis",
Expand Down
39 changes: 39 additions & 0 deletions config/passport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const passport = require('passport')
const LocalStrategy = require('passport-local')
const bcrypt = require('bcryptjs')
const { User } = require('../models')
// set up Passport strategy
passport.use(new LocalStrategy(
// customize user field
{
usernameField: 'account',
passwordField: 'password',
passReqToCallback: true
},
// authenticate user
(req, account, password, cb) => {
User.findOne({ where: { account } })
.then(user => {
if (!user) return cb(null, false, req.flash('error_messages', '帳號不存在!'))
bcrypt.compare(password, user.password).then(res => {
if (!res) return cb(null, false, req.flash('error_messages', '密碼輸入錯誤!'))
return cb(null, user)
})
})
}
))
// serialize and deserialize user
passport.serializeUser((user, cb) => {
cb(null, user.id)
})
passport.deserializeUser((id, cb) => {
return User.findByPk(id, {
include: [
{ model: User, as: 'Followers' },
{ model: User, as: 'Followings' }
]
})
.then(user => cb(null, user.toJSON()))
.catch(err => cb(err))
})
module.exports = passport
82 changes: 82 additions & 0 deletions controllers/admin-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
const { Tweet, User, Like } = require('../models')

const adminController = {
signInPage: (req, res) => {
res.render('admins/signin')
},
signIn: (req, res, next) => {
try {
const user = req.user.toJSON()
if (user.role === 'user') throw new Error('帳號不存在!')
req.flash('success_messages', '管理員成功登入!')
res.redirect('/admin/tweets')
} catch (err) {
next(err)
}
},
logout: (req, res) => {
req.flash('success_messages', '管理員登出成功!')
req.logout()
res.redirect('/admin/signin')
},
getAdminTweets: async (req, res, next) => {
try {
const tweets = await Tweet.findAll({
include: User,
raw: true,
nest: true,
order: [['createdAt', 'DESC']]
})
if (!tweets) throw new Error('沒有推文可顯示!')
tweets.forEach(tweet => {
tweet.description = tweet.description.substring(0, 50)
})
res.render('admins/tweets', { tweets, route: 'tweets' })
} catch (err) {
next(err)
}
},
deleteTweet: async (req, res, next) => {
try {
await Tweet.destroy({
where: { id: req.params.tweetId }
})
req.flash('success_messages', '成功刪除該則推文!')
res.redirect('/admin/tweets')
} catch (err) {
next(err)
}
},
getAdminUsers: async (req, res, next) => {
try {
const users = await User.findAll({
include: [
Tweet,
{ model: User, as: 'Followers' },
{ model: User, as: 'Followings' }
],
nest: true
})
if (!users) throw new Error('沒有使用者可顯示!')
const likes = await Like.findAll({ raw: true, nest: true })
const userInfos = users.filter(user => user.toJSON().role !== 'admin')
.map(user => {
const userInfo = user.toJSON()
userInfo.tweetCount = userInfo.Tweets.length
userInfo.likeCount = likes.filter(like => userInfo.Tweets.some(tweet => tweet.id === like.TweetId)).length
userInfo.followerCount = userInfo.Followers.length
userInfo.followingCount = userInfo.Followings.length
return userInfo
})
.sort((a, b) => b.tweetCount - a.tweetCount)
res.render('admins/users', {
userInfos,
route: 'users'
})
} catch (err) {
next(err)
}
}
}

module.exports = adminController
Loading