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

全端開發 - vin、susan、紹誠、庭維 #349

Open
wants to merge 352 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
352 commits
Select commit Hold shift + click to select a range
3ff0117
merged profile
shaochenn Jun 8, 2023
680c2f8
feat: add edit profile function
alvinkane Jun 8, 2023
5ae54b0
feat: modify admin/users page
VinChien Jun 8, 2023
f23c2e2
Merge pull request #16 from alvinkane/feature/profile
alvinkane Jun 9, 2023
ac24ee1
Merge branch 'master' into feature/tweets-controller
alvinkane Jun 9, 2023
9f6f72d
Merge pull request #18 from alvinkane/feature/tweets-controller
alvinkane Jun 9, 2023
5b02f16
Merge pull request #19 from alvinkane/feature/admin-users
alvinkane Jun 9, 2023
bfcb1ad
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 9, 2023
9408c6f
feat: add warning message for maximum text exceeded in front form
alvinkane Jun 9, 2023
74610cd
feat: add preview image
alvinkane Jun 9, 2023
9d7d005
feature/post-reply & get-tweet & isLiked
shaochenn Jun 9, 2023
c92f8ac
Merge branch 'master' into tweet-controller
shaochenn Jun 9, 2023
54e10c3
Merge branch 'master' into feature/seeder
Suz033 Jun 9, 2023
8ddf3a0
feat: add delete image function
alvinkane Jun 9, 2023
9da2553
feat: add scrollbar and button in profile page
alvinkane Jun 9, 2023
510f1c7
refactor: user seeder
Suz033 Jun 9, 2023
488cf98
refactor: remove bcrypt-nodejs
Suz033 Jun 9, 2023
c705ea3
fix: wrong db name in likes seeder
Suz033 Jun 9, 2023
1311425
refactor: remove repeat file
Suz033 Jun 9, 2023
f577808
feat: add followships seeder
Suz033 Jun 9, 2023
1c1db84
merge from origin
shaochenn Jun 9, 2023
65bf466
feat: change error messagev iew
alvinkane Jun 9, 2023
32cb5a7
feat: add front-end form validation
alvinkane Jun 9, 2023
d0b0633
feat: add auth-helper & modify auth.js、signin page
VinChien Jun 9, 2023
6dbc5a2
Fixed issue with <a> element triggering default behavior by adding ev…
shaochenn Jun 10, 2023
2a901dc
Merge pull request #20 from alvinkane/feature/editProfile
alvinkane Jun 10, 2023
7e7c7e4
Merge branch 'master' into feature/seeder
Suz033 Jun 10, 2023
de4168d
add profile link on user avatar
shaochenn Jun 10, 2023
4ec794a
feat: add routes
alvinkane Jun 10, 2023
e48acae
Merge branch 'master' into tweet-controller
shaochenn Jun 10, 2023
f881bb0
feat: let repeat data store in session
alvinkane Jun 10, 2023
4c246d5
code cleanup
shaochenn Jun 10, 2023
4dd1cad
merged from origin
shaochenn Jun 10, 2023
79e02ff
fix conflict
shaochenn Jun 10, 2023
3f22620
feat: add logout route
Suz033 Jun 10, 2023
21b5340
refactor: remove bcrypt-nodejs
Suz033 Jun 10, 2023
ba22908
Merge branch 'master' into feature/auth
VinChien Jun 10, 2023
fa76497
Merge branch 'master' into feature/homepage
shaochenn Jun 10, 2023
0983b3b
Merge pull request #15 from alvinkane/feature/homepage
shaochenn Jun 10, 2023
a460237
fix: fix admin login
VinChien Jun 10, 2023
b2f6077
feat: fix back function
alvinkane Jun 10, 2023
f13077a
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 10, 2023
69e84a9
Merge pull request #21 from alvinkane/tweet-controller
shaochenn Jun 10, 2023
1a92146
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 10, 2023
d08e31a
feat: add followship controller
Suz033 Jun 10, 2023
dbd3808
feat: add partial helper
Suz033 Jun 10, 2023
468bcae
resolve conflict
shaochenn Jun 10, 2023
38d9503
fix: fix auth.js
VinChien Jun 10, 2023
505c010
Merge branch 'master' into feature/auth
VinChien Jun 10, 2023
b4682c6
Merge pull request #22 from alvinkane/feature/auth
alvinkane Jun 10, 2023
5fec795
Merge branch 'master' into resolve-conflict
shaochenn Jun 10, 2023
453f3cb
feat: merge origin
alvinkane Jun 11, 2023
483f9ab
feat: add reply route in profile
alvinkane Jun 11, 2023
1eab9a8
fix route index
shaochenn Jun 11, 2023
afe0600
Update index.js
shaochenn Jun 11, 2023
1a94365
merged from origin
shaochenn Jun 11, 2023
369a8bd
feat: fix preview picture in front-end
alvinkane Jun 11, 2023
bc5002c
feat: navbar顯示的頁簽會跟著切換
alvinkane Jun 11, 2023
f88d496
Merge pull request #26 from alvinkane/resolve-conflict
shaochenn Jun 11, 2023
76f5733
feat: add back route
alvinkane Jun 11, 2023
70d8ff4
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 11, 2023
5f6ef0d
feat: add preious-page middleware
alvinkane Jun 11, 2023
c9577dc
feat: modify error text
alvinkane Jun 11, 2023
ca467d6
Merge pull request #24 from alvinkane/feature/editProfile
alvinkane Jun 11, 2023
bd4baca
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 11, 2023
808970a
feat: add pagination if data > 50
alvinkane Jun 11, 2023
992b9ac
error message
shaochenn Jun 11, 2023
0cfe703
trim tweet & reply content before upload
shaochenn Jun 11, 2023
fde2fae
fix multiple reply need multiple event-listener
shaochenn Jun 11, 2023
7217977
feat: admin-controller & user-controller
VinChien Jun 11, 2023
7077ec4
fix conflict
shaochenn Jun 11, 2023
8bd75ae
Merge branch 'master' into feature/admin-controller
VinChien Jun 11, 2023
80ef6f7
fix: modify message
VinChien Jun 11, 2023
7761727
Merge remote-tracking branch 'origin/master' into fix-conflict
shaochenn Jun 11, 2023
28cd337
feat: add getTopFollowedUsers in followship controller
Suz033 Jun 12, 2023
3ce06dc
fixed UnhandledPromiseRejection in tweets-controller
shaochenn Jun 12, 2023
580c803
Merge branch 'master' into feature/seeder
Suz033 Jun 12, 2023
e6dca94
Merge pull request #30 from alvinkane/fix-conflict
alvinkane Jun 12, 2023
01f09f3
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 12, 2023
783fd66
feat: fix followship list
alvinkane Jun 12, 2023
05e71fd
Update follower controller to match test file specifications
shaochenn Jun 12, 2023
2de04fc
Merge pull request #32 from alvinkane/fix-UnhandledPromiseRejectionWa…
shaochenn Jun 12, 2023
a2f0f8b
feat: fix go to previous page bug
alvinkane Jun 12, 2023
97617d6
feat: fix like cannot like and follow list can go to profile page
alvinkane Jun 12, 2023
9471f94
Merge branch 'master' into feature/admin-controller
VinChien Jun 12, 2023
1a13e5e
feat: add ifQuery helpers
alvinkane Jun 12, 2023
0ef9a25
Merge remote-tracking branch 'origin' into feature/editProfile
alvinkane Jun 12, 2023
1a83d6a
feat: 將追隨者的數量也包含在連結中
alvinkane Jun 12, 2023
aeec040
feat: 將是否追隨排序
alvinkane Jun 12, 2023
ba792b2
Merge pull request #29 from alvinkane/feature/admin-controller
VinChien Jun 12, 2023
46a59e0
Merge pull request #33 from alvinkane/Update-follower-controller
alvinkane Jun 12, 2023
9c302e9
Merge remote-tracking branch 'origin' into feature/seed
alvinkane Jun 12, 2023
de5d375
Merge branch 'master' into feature/fix-error
shaochenn Jun 12, 2023
88f0961
feat: add can't follow self
alvinkane Jun 12, 2023
928d143
feat: modify user-controller/signup
VinChien Jun 12, 2023
ce577f4
feat: delete reference in migration
alvinkane Jun 12, 2023
b5fc54c
Update handlebars-helpers.js
alvinkane Jun 12, 2023
166d9f5
feat: fix test spec error
alvinkane Jun 12, 2023
8475cae
Merge pull request #34 from alvinkane/feature/fix-error
alvinkane Jun 12, 2023
34d00ee
Merge remote-tracking branch 'origin' into feature/seed
alvinkane Jun 12, 2023
2edc0cd
Merge pull request #35 from alvinkane/feature/admin-controller
alvinkane Jun 13, 2023
0747af6
Merge remote-tracking branch 'origin' into feature/followingList
alvinkane Jun 13, 2023
37b39e8
feat: 統一更換為index為主
alvinkane Jun 13, 2023
61e233c
feat: update follow list
alvinkane Jun 13, 2023
950a726
feat: 補充資料在各個頁面
alvinkane Jun 13, 2023
bf1e38d
Merge branch 'master' into feature/layout
Suz033 Jun 13, 2023
9040a29
fix: fix 喜歡跟回覆的數量計算
alvinkane Jun 13, 2023
a069f43
feat: add 別人無法對觀看對象的喜歡內容做任何動作
alvinkane Jun 13, 2023
6f1200f
Merge pull request #36 from alvinkane/feature/seed
alvinkane Jun 13, 2023
574ff08
feat: 對seed加入限制條件
alvinkane Jun 13, 2023
10ed014
Merge remote-tracking branch 'origin' into feature/fix-function
alvinkane Jun 13, 2023
8ff3ede
feat: add deleteTweet function
VinChien Jun 13, 2023
f825a02
Merge pull request #37 from alvinkane/feature/followingList
shaochenn Jun 13, 2023
1754442
feat: 將自己排除於推薦列表
alvinkane Jun 13, 2023
5b33f32
Update followship-controller.js
shaochenn Jun 13, 2023
24778d9
feat: 修正不能取消喜歡的推文功能
alvinkane Jun 13, 2023
5a97acd
Merge remote-tracking branch 'origin' into feature/fix-function
alvinkane Jun 13, 2023
6892ad9
Merge branch 'feature/fix-function' of https://github.com/alvinkane/t…
alvinkane Jun 13, 2023
128c63b
feat: add like function in user-like page
alvinkane Jun 13, 2023
1acc2a7
feat: modify deleteTweet
VinChien Jun 13, 2023
97728e2
feat: adminGetTweets add slice
VinChien Jun 13, 2023
deb3f54
feat: modify style and few functions
Suz033 Jun 13, 2023
b515f86
Merge pull request #38 from alvinkane/feature/fix-function
alvinkane Jun 14, 2023
3b00c36
Merge pull request #39 from alvinkane/feature/admin-controller
alvinkane Jun 14, 2023
938544e
feat: add logout function
alvinkane Jun 14, 2023
f385f17
Merge remote-tracking branch 'origin' into feature/logout
alvinkane Jun 14, 2023
d6f782f
feat: fix error messages in signup page
alvinkane Jun 14, 2023
b90c8be
feat: add 註冊的名字不能超過上限
alvinkane Jun 14, 2023
126b22c
fix: 回覆頁沒有追蹤列表資料
alvinkane Jun 14, 2023
2719d73
feat: 新增回覆沒有輸入會跳提示
alvinkane Jun 14, 2023
fea243f
fix: 解決歷史紀錄有重複頁面問題
alvinkane Jun 14, 2023
9b6cf1c
feat: add 在別人的個人資料畫面,判斷登入者是否有無跟隨過
alvinkane Jun 14, 2023
5600779
feat: add 回覆列表排序功能
alvinkane Jun 14, 2023
e44c77c
merge origin/master & feature/layout
shaochenn Jun 14, 2023
0781643
fix: 修正喜歡的內容時間顯示
alvinkane Jun 14, 2023
f80bdbc
merge origin/master & feature/layout
shaochenn Jun 14, 2023
c0528a6
feat: 將追蹤列表變為每次都更新
alvinkane Jun 14, 2023
a6e3b5b
Delete partial-helpers.js
shaochenn Jun 14, 2023
1a304eb
Merge pull request #42 from alvinkane/merge-feature/layout
alvinkane Jun 14, 2023
3de165a
Merge remote-tracking branch 'origin' into feature/check-acc
alvinkane Jun 14, 2023
0ddba94
fix : 修正edit頁面錯誤提示
alvinkane Jun 14, 2023
6f0c874
fix: 修正profile頁面錯誤提示
alvinkane Jun 14, 2023
df5d468
feat: 新增回覆頁推文者頭像可以進入個人頁面
alvinkane Jun 14, 2023
71760d6
fix: 修正追隨列表更改樣式
alvinkane Jun 14, 2023
af0eb88
fix: 推薦列表頭像更換為自己的
alvinkane Jun 14, 2023
fc11f54
fix: 修正追隨種子資料會重複追隨問題
alvinkane Jun 14, 2023
85739d0
fix: 修正註冊帳號的錯誤提示格式
alvinkane Jun 14, 2023
7fce092
feat: 新增推薦列表可以到個人資料頁面
alvinkane Jun 14, 2023
be28393
fix: 修正追隨種子資料可能會追隨到同個人
alvinkane Jun 14, 2023
a4f8921
feat: 新增追蹤列表資料在回覆頁
alvinkane Jun 14, 2023
426d9c1
display error message when tweet & reply content is invalid
shaochenn Jun 14, 2023
40374e0
fix: 修正追隨者時間排序
alvinkane Jun 14, 2023
6b890ea
fix: 修正自己不能追隨自己的按鈕顯示
alvinkane Jun 14, 2023
4e663d9
Merge pull request #44 from alvinkane/feature/check-acc
shaochenn Jun 14, 2023
5380041
fix: 修正後台刪除功能
alvinkane Jun 14, 2023
05802ea
Merge remote-tracking branch 'origin' into feature/check-acc
alvinkane Jun 14, 2023
bdf9c73
Merge branch 'master' into feature/display-error-msg
shaochenn Jun 14, 2023
6c2b13b
fix: 移除nav變數
alvinkane Jun 14, 2023
f59b07d
Merge pull request #43 from alvinkane/feature/display-error-msg
alvinkane Jun 14, 2023
fa4653d
merge: origin
alvinkane Jun 14, 2023
ff38a8e
feat: 修正test擋問題
alvinkane Jun 14, 2023
97e3e36
feat: 修正上一頁問題
alvinkane Jun 14, 2023
fc70b02
fix: 修正navbar無法顯示問題
alvinkane Jun 14, 2023
1401354
Merge branch 'master' into feature/check-acc
Suz033 Jun 14, 2023
6f99136
fix: 修正like種子資料重複問題
alvinkane Jun 14, 2023
655c6e6
fix: 修正樣式
alvinkane Jun 14, 2023
c357c1d
Merge remote-tracking branch 'origin' into feature/check-acc
alvinkane Jun 14, 2023
46db7ec
Merge remote-tracking branch 'origin/feature/check-acc' into feature/…
alvinkane Jun 14, 2023
3b047e2
fix: 修正後臺登入錯誤會到後臺登入頁面
alvinkane Jun 14, 2023
41ee008
fix: 更換刪除資料方法使其符合測試擋
alvinkane Jun 14, 2023
0e07be1
justify seeder img
shaochenn Jun 14, 2023
3492ac3
fix: 修改後臺嘗試登入前台畫面的redirect頁面
alvinkane Jun 14, 2023
e7c3b9f
fix: 修改密碼確認名稱,使其符合測試檔
alvinkane Jun 14, 2023
d5d0ed1
fix: migration設定預設值,以符合測試擋
alvinkane Jun 14, 2023
a20ead3
feat: 修改topuser以符合測試擋
alvinkane Jun 14, 2023
6696b59
Merge pull request #45 from alvinkane/feature/check-acc
shaochenn Jun 14, 2023
2d0d624
admin controller test
shaochenn Jun 14, 2023
c7f3a61
feat: modify admin-controller/adminGetUsers
VinChien Jun 14, 2023
0db06d6
Merge branch 'master' into feature/admin-controller
VinChien Jun 14, 2023
f2dea06
feat: add wrap tweet func and show more btn
Suz033 Jun 14, 2023
eb1dea3
fix : deleteTweet
VinChien Jun 14, 2023
89655c1
Merge branch 'feature/admin-controller' of https://github.com/alvinka…
VinChien Jun 14, 2023
4f0b92f
Merge branch 'master' into feature/layout
Suz033 Jun 15, 2023
1590fc6
Merge pull request #46 from alvinkane/feature/admin-controller
shaochenn Jun 15, 2023
cbdea82
fix: delete test spec
alvinkane Jun 15, 2023
35579ce
feat: add bcrypt-nodejs for travis
alvinkane Jun 15, 2023
7e324a3
Merge pull request #48 from alvinkane/feature/travis
alvinkane Jun 15, 2023
6b26de4
nothing
shaochenn Jun 15, 2023
030badd
feat: 新增後臺使用者列表照著推文數量排序
alvinkane Jun 15, 2023
eae4ecb
feat: 註冊頁面新增scroll bar
alvinkane Jun 15, 2023
96cb2e9
feat: 修正後台登出後的路徑
alvinkane Jun 15, 2023
51787e2
feat: modify index and recommend list scrollbar
Suz033 Jun 15, 2023
8c54430
console
shaochenn Jun 15, 2023
c7b2dd5
fix: 修正刪除資料導致喜歡內容無法顯示的問題
alvinkane Jun 15, 2023
4ef4c13
delete: 刪除console.log
alvinkane Jun 15, 2023
bf44f89
Merge pull request #49 from alvinkane/feature/final-check
alvinkane Jun 15, 2023
b8d9bd2
Merge branch 'master' into feature/layout
Suz033 Jun 15, 2023
e80d92b
feat: modify style of signup scrollbar
Suz033 Jun 15, 2023
fa38383
Merge pull request #50 from alvinkane/feature/layout
Suz033 Jun 15, 2023
8f7b9ab
feat: add show password
VinChien Jun 15, 2023
e57f1ee
Create README.md
VinChien Jun 15, 2023
6681cfc
feat: add random date on tweet seed
alvinkane Jun 16, 2023
7f45143
fix: 修正getUser controller中user跟其他資料一起處理可能會有問題的部分
alvinkane Jun 16, 2023
aee6dd4
refactor: 將getUser移到middleware
alvinkane Jun 16, 2023
322ee42
refactor: 將getTopFollowedUsers移到middleware
alvinkane Jun 16, 2023
6c67fe6
refactor: 隱藏upload相關資訊
alvinkane Jun 16, 2023
bd03a0a
refactor: 重構pagination的一些資料
alvinkane Jun 16, 2023
26581e7
fix: 將沒有用到的hbs刪除
alvinkane Jun 16, 2023
6450ec5
split route handler & resolve profile pic display issue in replies
shaochenn Jun 16, 2023
0811630
code cleanup
shaochenn Jun 16, 2023
5460714
Merge pull request #53 from alvinkane/feature/random-date
shaochenn Jun 16, 2023
36a81ad
fix: 修改個人資料獲取方式由前端取得
alvinkane Jun 16, 2023
87db2d4
Merge pull request #54 from alvinkane/feature/refactor-controller
shaochenn Jun 16, 2023
edf81c7
Merge remote-tracking branch 'origin' into feature/refactor-controller
alvinkane Jun 16, 2023
e6a2483
refactor route
shaochenn Jun 16, 2023
9443f54
merged origin/master
shaochenn Jun 16, 2023
5fe2a42
Merge branch 'master' into refactor-route-again
shaochenn Jun 16, 2023
7ea7dc2
Update users.js
shaochenn Jun 16, 2023
60e4611
Update style.css
shaochenn Jun 16, 2023
a6ff69d
fixed reply content restriction
shaochenn Jun 16, 2023
94f317b
feat: modify style
Suz033 Jun 16, 2023
7607b19
Merge pull request #51 from alvinkane/feature/signup-password-eye
Suz033 Jun 16, 2023
2d5fdda
Merge branch 'master' into feature/layout
Suz033 Jun 16, 2023
9615dad
Merge branch 'master' into refactor-route-again
shaochenn Jun 16, 2023
7f8dee9
Merge pull request #52 from alvinkane/feature/add-README
shaochenn Jun 17, 2023
f5650b8
Merge pull request #56 from alvinkane/feature/refactor-controller
shaochenn Jun 17, 2023
5980ec2
Merge branch 'master' into feature/layout
shaochenn Jun 17, 2023
ae03243
Merge pull request #58 from alvinkane/feature/layout
shaochenn Jun 17, 2023
fff370c
Merge pull request #57 from alvinkane/refactor-route-again
shaochenn Jun 17, 2023
eb8c5dc
fix previous page button
shaochenn Jun 17, 2023
83ea91c
Merge remote-tracking branch 'origin/master' into fix-reply-restriction
shaochenn Jun 17, 2023
1b3bf30
fix: fix class name
alvinkane Jun 17, 2023
7773711
fix: fix class
alvinkane Jun 17, 2023
311aaae
Merge branch 'feature/fix-class' of https://github.com/alvinkane/twit…
alvinkane Jun 17, 2023
067463f
delete: delete console.log
alvinkane Jun 17, 2023
37404f2
fix time diplay issue in reply section & get top followed route
shaochenn Jun 17, 2023
24a72d8
Update modal-reply.hbs
shaochenn Jun 17, 2023
fe2a89c
Merge pull request #59 from alvinkane/feature/fix-class
shaochenn Jun 17, 2023
701c205
Update modal-tweet.hbs
shaochenn Jun 17, 2023
b99d832
Merge pull request #60 from alvinkane/time-display-issue
shaochenn Jun 17, 2023
c3a1772
fix nav profile button display issue
shaochenn Jun 17, 2023
a9b475e
Update README.md
VinChien Jun 17, 2023
8c2d11b
Merge pull request #62 from alvinkane/feature/add-README
shaochenn Jun 17, 2023
3149709
Merge pull request #61 from alvinkane/fix-nav-display-issue
VinChien Jun 18, 2023
8ec05e1
fix and optimize admin user list liked count
shaochenn Jun 18, 2023
9dac796
Merge remote-tracking branch 'origin/master' into fix-admin-userListLike
shaochenn Jun 18, 2023
7061c7f
update readme
shaochenn Jun 18, 2023
fc02407
Merge pull request #63 from alvinkane/fix-admin-userListLike
alvinkane Jun 18, 2023
1b9aabd
fix reply name display
shaochenn Jun 19, 2023
4221523
Merge pull request #64 from alvinkane/fix-reply-name-display-issue
alvinkane Jun 19, 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=
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/*
/test/*
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
198 changes: 198 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# twitter-fullstack-2020
ALPHA Camp | 學期 3 | Simple Twitter | 自動化測試檔 (全端開發組)

## 畫面

![asignin](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/28645bb7-d212-460a-88d3-3535539e0c76)
![admi-signin](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/efa1714f-cadc-4780-a9ab-5d171e19a845)
![signup](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/624ea2de-f028-4a69-94a3-b3ec18c9c53b)
![tweets](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/990466b3-4f45-4a80-bbd6-79d7f3e78beb)
![create-new-tweet](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/395738ce-4806-4d93-b519-12c219ff193c)
![tweet-reply](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/46c4737f-ebb5-4fb0-8aed-47447cce2405)
![user-profile](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/661d5d90-eb24-4f33-bf0e-53379bff3d41)
![user-edit](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/c0146f06-e191-4d07-a7e5-244e8f49334e)
![user-account-edit](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/b203dd07-c19c-42ff-a723-ac02e63cf7dc)
![admin-tweets](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/7ff6ce85-8e63-4ec1-82dd-d2a86d162d11)
![admin-users](https://github.com/alvinkane/twitter-fullstack-2020/assets/55631549/f47b02b1-fecc-413a-b62a-baaa228569ae)


## 功能

這個網站有兩種使用角色:

一般使用者 ( 以下稱 `user` )、管理員 ( 以下稱 `admin` )。

user 活動的地方稱為「`前台`」。

admin 活動的地方稱為「`後台`」。

admin 帳號`不能登入前台、不能使用前台的功能`。

user 帳號`也不能登入後台、不能使用後台的功能`。

前台與後台有不同的登入入口。

### 註冊 / 登入

訪客可以自行註冊成為 user,但 admin 帳號`無法自行註冊`。

admin 帳號會由工程師手動開設,例如直接操作資料庫或設定種子資料。

除了`註冊`和`登入頁`,使用者一定要登入才能使用網站。當使用者`尚未註冊`便試圖登入時,會有錯誤提示 : `帳號或密碼錯誤`。

`註冊`時訪客可以設定 account、name (上限 50 字)、email 和 password。

`註冊/編輯`時,account 和 email 不能與其他人重複,若有重複會跳出錯誤提示 : `account 已重複註冊!`、`email 已重複註冊!`。

### 個人資料

`使用者`能編輯自己的名稱、自我介紹、個人頭像與封面,自我介紹數字上限 160 字、暱稱上限 50 字,超過會跳出錯誤提示 : `字數超出上限!`。

個人頁面橫幅背景預設山景圖。

### 貼文留言

`使用者`能在首頁瀏覽所有的推文 (tweet),所有 Tweets 依 create 日期排序,最新的在前。

`使用者`點擊貼文方塊時,能查看貼文與回覆串。

`使用者`能回覆別人的推文,回覆文字不能為空白,空白會跳出錯誤提示 : `內容不可空白`。

`使用者`無法回覆他人回覆,也無法針對他人的回覆按 Like/Unlike。

`點擊貼文中使用者頭像`時,能瀏覽該使用者的個人資料及推文。

使用者能新增推文,字數限制在 140 以內,空白或超過會跳出錯誤提示 : `內容不可空白`、`字數不可超過140字`。

### 使用者互動

`使用者`可以追蹤/取消追蹤其他使用者 (不能追蹤自己)。

`使用者`能對別人或自己的推文按 Like/Unlike。

### 數據摘要

任何登入使用者都可以瀏覽特定使用者的以下資料:

`推文 (Tweets)`:排序依日期,最新的在前。

`推文與回覆`:使用者回覆過的內容,排序依日期,最新的在前。

`跟隨中 (Following)`:該使用者的關注清單,排序會先排(正在追隨->自己->未追隨)再來才會依照追蹤紀錄成立的時間,愈新的在愈前面。

`跟隨者 (Follower)`:該使用者的跟隨者清單,排序會先排(正在追隨->自己->未追隨)再來才會依照追蹤紀錄成立的時間,愈新的在愈前面。

`喜歡的內容 (Like)`:該使用者 like 過的推文清單,排序依 like 紀錄成立的時間,愈新的在愈前面。

`使用者`能在`首頁的側邊欄`,看見跟隨者 (followers) 數量排列前 10 的推薦跟隨名單。

### 後台

管理者可從專門的後台登入頁面進入網站後台。

管理者帳號`不可登入前台`。

若使用管理帳號登入前台,或使用一般使用者帳號登入後台,等同於「帳號不存在」。

管理者可以`瀏覽全站的 Tweet 清單`。

可以直接在清單上`快覽 Tweet 的前 50 個字`。

可以在清單上`直接刪除任何人的推文`。

管理者可以`瀏覽站內所有的使用者清單`,清單的資訊包括 :

* 使用者的 :

* 推文數量(指使用者的 Tweet 累積總量)。

* 跟隨人數。

* 跟隨者人數。

* 推文被 like 的數量(指使用者的 Tweet 獲得 like 的累積總量)。

使用者清單預設按推文數排序,由多至少。


## 初始化
### 下載專案
```
git clone https://github.com/alvinkane/twitter-fullstack-2020.git
```
### 下載相關套件
移動到資料夾內後執行以下指令下載套件
```
npm install
```
### 設定環境變數
參考.env.example新增.env檔設定環境變數
### 確認測試環境設定
packge.json裡指令預設使用set \"NODE_ENV=test\"指令來改變測試環境,適用於Cmder。
若你是使用git bash可以參考以下手動更改測試環境:
由於本地開發預設會使用 development 設定,因此需要使用指令切換到測試環境。
切換到測試環境,如果在等號後加其他的字串,則會切到其他的環境。
```
export NODE_ENV=test
```
確認目前使用的環境。
```
echo $NODE_ENV
```
第一次呼叫 `echo $NODE_ENV` 時,回傳值會是空白的,但在空白情況下,本地會預設使用 development 環境。
### 設定資料庫
新增兩個資料庫,開發環境用的,以及測試環境用的。
在一個新的 Query 頁面輸入 SQL 指令。
```
create database ac_twitter_workspace;
create database ac_twitter_workspace_test;
```
use 後面加上要使用的資料庫
```
use ac_twitter_workspace;
```
### 執行 Migration
```
npx sequelize db:migrate
```
查看現有版本
```
npx sequelize db:migrate:status
```
將所有的 Migrations 還原至最初尚無 Migration 的階段。
```
npx sequelize db:migrate:undo:all
```
### 執行Sseeder
用指令生成種子資料:
```
npx sequelize db:seed:all
```
還原
```
npx sequelize db:seed:undo:all
```
如果忘記指令怎麼拼,可以使用 sequelize --help 叫出指令清單。
```
sequelize --help
```
### 執行測試
執行測試檔前 要先執行 npx sequelize db:seed:undo:all 清空資料庫
```
npm run test
```
package.json還提供其他指令
```
npm run start
npm run dev
```
分別對應以下功能
"start": "set \"NODE_ENV=development\" && node app.js",
"dev": "set \"NODE_ENV=development\" && nodemon app.js",
"test": "set \"NODE_ENV=test\" && mocha test --exit --recursive --timeout 5000"
執行完npm run start後就能在網頁輸入網址http://localhost:3000/ 開始使用twitter
### 測試帳號

* 1 組 admin 帳號:`root`
* 5 組 user 帳號:`user1 ~ 5`
* 密碼都是:`12345678`
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
}
65 changes: 59 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,66 @@
// modules
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config()
}
const express = require('express')
const helpers = require('./_helpers');

const app = express()
const port = 3000
const handlebars = require('express-handlebars')
const session = require('express-session')
const flash = require('connect-flash')
const methodOverride = require('method-override')
const passport = require('./config/passport')

// helpers
const handlebarsHelpers = require('./helpers/handlebars-helpers')
const helpers = require('./_helpers')
const previousPage = require('./middleware/previous-page')

// files
const routes = require('./routes')
app.use(express.static('public'))

const port = process.env.PORT || 3000
const SESSION_SECRET = process.env.SESSION_SECRET || 'simple_twitter_session_secret'

app.engine('hbs', handlebars({ extname: '.hbs', defaultLayout: 'main', helpers: handlebarsHelpers }))
app.set('view engine', 'hbs')

app.use(express.urlencoded({ extended: true }))
app.use(express.json())

app.use(
session({
secret: SESSION_SECRET,
resave: false,
saveUninitialized: false
})
)

app.use(flash())

app.use(passport.initialize())
app.use(passport.session())

app.use(methodOverride('_method'))

app.use(previousPage)

// use helpers.getUser(req) to replace req.user
// use helpers.ensureAuthenticated(req) to replace req.isAuthenticated()
app.use((req, res, next) => {
res.locals.success_messages = req.flash('success_messages')
res.locals.error_messages = req.flash('error_messages')
res.locals.warning_messages = req.flash('warning_messages')
res.locals.info_messages = req.flash('info_messages')
// 為了不跟user的資料衝突,所以更換名字
res.locals.loginUser = helpers.getUser(req)
res.locals.isAuthenticated = helpers.ensureAuthenticated(req)
// 上一頁
res.locals.previousPage = req.session.previousPage
next()
})

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

// exports
module.exports = app
8 changes: 2 additions & 6 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": "CLEARDB_DATABASE_URL"
},
"travis": {
"username": "travis",
Expand All @@ -28,4 +24,4 @@
"dialect": "mysql",
"logging": false
}
}
}
Loading