Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
1a122ef
Update README.md
Luca-Terrazzan Feb 2, 2024
724ff13
Update README.md
Luca-Terrazzan Feb 2, 2024
3640cb2
Update README.md
Luca-Terrazzan Feb 2, 2024
a26db63
updated app name
Luca-Terrazzan Feb 2, 2024
1bf3efe
change to force pre-commit
Auenc Feb 2, 2024
b5662c2
updated prepare script
Auenc Feb 2, 2024
675acf4
automatic flyio changes to config
Luca-Terrazzan Feb 2, 2024
2bdae46
don't specify vm
Luca-Terrazzan Feb 2, 2024
96f50f7
chore: update husky version
Auenc Feb 2, 2024
8164f51
Merge branch 'main' of github.com:boolean-uk/team-dev-server-c11
Auenc Feb 2, 2024
c23b4f0
extrapolate migration command to dockerfile
Luca-Terrazzan Feb 2, 2024
eb27e62
Merge branch 'main' of https://github.com/boolean-uk/team-dev-server-c11
Luca-Terrazzan Feb 2, 2024
e020408
downgrade flytoml
Luca-Terrazzan Feb 2, 2024
1b691eb
remove test command
Luca-Terrazzan Feb 2, 2024
9b1d283
chore: updating deployed api url
Auenc Feb 5, 2024
223bfac
Merge pull request #2 from boolean-uk/1-update-deployed-api-docs-link…
Auenc Feb 5, 2024
bcb3f51
build: add updateAt and createdAt to schema
Chloe070196 Feb 6, 2024
c642cbd
build: add prisma migration for createdAt and updatedAt
Chloe070196 Feb 6, 2024
9e43404
feat: update create() to call createPost()
Chloe070196 Feb 6, 2024
42be8f6
feat: createPost()
Chloe070196 Feb 6, 2024
b2f39e9
fix: amend create()
Chloe070196 Feb 6, 2024
d69bcca
feat: getPosts()
Chloe070196 Feb 6, 2024
a966273
feat: update getAll() to call getPosts()
Chloe070196 Feb 6, 2024
dcc6593
fix: return created post
Chloe070196 Feb 6, 2024
cdf6f47
fix: add try...catch
Chloe070196 Feb 6, 2024
fdac52b
fix: add console.error
Chloe070196 Feb 6, 2024
7ce1358
Merge pull request #7 from boolean-uk/Chloe070196-#6-modify_server_fi…
Chloe070196 Feb 6, 2024
82ae5b3
fix: add mock author data to posts in getAll()
Chloe070196 Feb 6, 2024
48e4d7c
fix: use user.profile data instead of mock
Chloe070196 Feb 6, 2024
811eff5
build: test migration file
Chloe070196 Feb 6, 2024
fd7282d
feat: move mapping into domain
Chloe070196 Feb 6, 2024
3a3680f
feat: update getPosts to throw an error if user.profile is missing
Chloe070196 Feb 6, 2024
9d9756b
fix: post.author only has two properties
Chloe070196 Feb 6, 2024
1c03a79
Merge pull request #9 from boolean-uk/Chloe070196-#8-problem-with-bre…
NazarTymiv Feb 7, 2024
c703841
findManyByFirstOrLastName
Faiza-tech Feb 7, 2024
ded48e3
Merge pull request #10 from boolean-uk/5-add-findmanybyfirstorlastnam…
EwbiDev Feb 7, 2024
4670ccd
amended status code to 409 for exising user when registering
Satokii Feb 7, 2024
ae073b3
removed redundant console log, added error printout
Satokii Feb 7, 2024
497ab9b
Merge pull request #12 from boolean-uk/11-change-status-code-to-409-w…
Satokii Feb 7, 2024
2fa02f5
feat: amend getAll() to take name query
EwbiDev Feb 7, 2024
a8b4b60
feat: amend getAll() to take name query
EwbiDev Feb 7, 2024
59ff539
build: install morgan express middleware
EwbiDev Feb 7, 2024
11ce781
Merge branch '4-amend-getall-user-controller-to-accept-string-contain…
Faiza-tech Feb 7, 2024
40834b9
need to solve
Faiza-tech Feb 7, 2024
8f60a6f
Merge pull request #14 from boolean-uk/13-add-morgan-express-middleware
EwbiDev Feb 7, 2024
1126277
Merge branch 'main' into 4-amend-getall-user-controller-to-accept-str…
EwbiDev Feb 7, 2024
83fa968
added new router
Callumhayden99 Feb 8, 2024
0fe1b8b
Add Comment model and likes for post
NazarTymiv Feb 8, 2024
5384e41
Add fields to the comment and relation with user
NazarTymiv Feb 8, 2024
6cabc5f
deleting post has been added to the controller and domain file
Callumhayden99 Feb 8, 2024
06797ae
Merge pull request #18 from boolean-uk/NazarTymiv-17-comments-model-f…
NazarTymiv Feb 8, 2024
aa2830e
fix: amend method to return User instance
EwbiDev Feb 8, 2024
29e3f85
fix: amend method input to be case insensitive
EwbiDev Feb 8, 2024
eed1ae9
refactor: remove namePart set
EwbiDev Feb 8, 2024
0120c1b
Add new model Like and relation with userId and postId
NazarTymiv Feb 8, 2024
1f51b30
Merge pull request #22 from boolean-uk/NazarTymiv-20-create-new-model…
NazarTymiv Feb 8, 2024
c42c1a5
feat: endpoint returns userList sorted by result count
EwbiDev Feb 8, 2024
b10e010
delete function working, just need to fix the refresh issue
Callumhayden99 Feb 8, 2024
7ff0b4e
refactor: extract or query
EwbiDev Feb 8, 2024
e9d9206
refactor: relocate controller logic to domain
EwbiDev Feb 8, 2024
c2cadae
refactor: move controller logic to domain
EwbiDev Feb 8, 2024
120dba3
created the edit post button, just need to work on client side now to…
Callumhayden99 Feb 8, 2024
cc2ae80
docs: update docs
EwbiDev Feb 8, 2024
48e8ebd
edit and delete server side is fully working
Callumhayden99 Feb 8, 2024
1b0e86d
fully refactored code to meet review requirements
Callumhayden99 Feb 8, 2024
200f74c
fix: add guard clause
EwbiDev Feb 8, 2024
f616fb4
refactor: relocate query options
EwbiDev Feb 8, 2024
190d5cf
feat: GET/posts route: posts include comments and likes
Chloe070196 Feb 8, 2024
00f3aa5
Merge pull request #19 from boolean-uk/15-fix-userfindmanybyfirstname…
EwbiDev Feb 8, 2024
50be933
Merge pull request #23 from boolean-uk/4-amend-getall-user-controller…
EwbiDev Feb 8, 2024
a6a818b
build: add comments and likes to posts in seed
Chloe070196 Feb 8, 2024
aa89ce2
docs: update .yml to reflect changes
Chloe070196 Feb 8, 2024
08eec8f
more chanages to the requirements made
Callumhayden99 Feb 8, 2024
7f84998
Merge branch 'main' into Callumhayden99-16-delete-put-endpoints-for-p…
Callumhayden99 Feb 8, 2024
ed2903c
Merge pull request #24 from boolean-uk/Callumhayden99-16-delete-put-e…
Callumhayden99 Feb 8, 2024
9310fb2
fix: handle case where no query param in request
EwbiDev Feb 8, 2024
0c729db
refactor: add curly brackets
EwbiDev Feb 8, 2024
dba9f82
Merge pull request #30 from boolean-uk/29-get-users-crashes-server-wh…
EwbiDev Feb 8, 2024
e59c763
docs: add missing properties to Posts schema
Chloe070196 Feb 8, 2024
58bd999
fix: remove redundancies
Chloe070196 Feb 8, 2024
3d5a5b9
Merge pull request #28 from boolean-uk/25-getposts-route-comments-and…
Chloe070196 Feb 8, 2024
3b69577
added the put to the docs, just need to add the delete one and place …
Callumhayden99 Feb 8, 2024
bb5b612
updated the .yml files for the put and delete functions
Callumhayden99 Feb 9, 2024
d4a0075
Merge pull request #35 from boolean-uk/31-api-docs-update-the-documen…
Callumhayden99 Feb 9, 2024
cacf71a
Comment, Like and Post models created / updated
LAVINIABENZAR Feb 9, 2024
de29ad8
Merge pull request #36 from boolean-uk/34-fix-required-re-insert-a-co…
LAVINIABENZAR Feb 9, 2024
964f087
created a new router, controller and domain file for the like function
Callumhayden99 Feb 9, 2024
c1dfa56
updated the code to meet review requirements
Callumhayden99 Feb 9, 2024
7fc4771
get endpoint for comments
LAVINIABENZAR Feb 9, 2024
f5a10b4
Add new router /comments
NazarTymiv Feb 9, 2024
72ecc3f
Add comments controller
NazarTymiv Feb 9, 2024
3f07434
Update global error handler
NazarTymiv Feb 9, 2024
89a64db
Add global error handler
NazarTymiv Feb 9, 2024
c90916f
Add checkFields error handler
NazarTymiv Feb 9, 2024
9131cc7
Add createCommentDb
NazarTymiv Feb 9, 2024
62a8660
Add comment controller createComment
NazarTymiv Feb 9, 2024
839eaa3
Fix problem in domain comments file
NazarTymiv Feb 9, 2024
0a1bdde
Add validate authentication
NazarTymiv Feb 9, 2024
6f8bc7d
prettier fix
LAVINIABENZAR Feb 11, 2024
d864860
Delete console log in comments controller
NazarTymiv Feb 12, 2024
bd88f99
Update checkFields function
NazarTymiv Feb 12, 2024
12be069
Merge pull request #43 from boolean-uk/NazarTymiv-42-post-endpoint-fo…
NazarTymiv Feb 12, 2024
ac2ecc7
Merge pull request #38 from boolean-uk/Callumhayden99-37-updating-the…
NazarTymiv Feb 12, 2024
23230e2
Fix issue with likes
NazarTymiv Feb 12, 2024
33d501e
Merge pull request #45 from boolean-uk/NazarTymiv-44-fix-issue-with-r…
NazarTymiv Feb 12, 2024
f1476ce
refactor: use class
Chloe070196 Feb 12, 2024
2678fb7
Merge branch 'main' into loredana-benzar-40-get-comments-endpoint
Chloe070196 Feb 12, 2024
0cdb269
refactor: getALl returns class instances
Chloe070196 Feb 12, 2024
dbcae44
docs: add comments get endpoint
Chloe070196 Feb 12, 2024
edcfc04
chore: remove console.log
Chloe070196 Feb 12, 2024
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
5 changes: 0 additions & 5 deletions .env.example

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
with:
node-version: 'lts/*'
- run: npm ci
- run: npx eslint src
- run: npx prisma migrate reset --force --skip-seed
- run: npm run lint
- run: npm run db-reset
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH

RUN npm run migrate

CMD [ "npm", "run", "start" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Once you have complete the above guide, continue to the steps below.
## API Spec

[TODO]: <Deploy and update the link below>
[Deployed API Spec](https://UPDATEME)
[Deployed API Spec](https://boolean-team-dev-server.fly.dev/api-docs/)

The API Spec is hosted by the server itself (i.e. this project), and the view/page is generated automatically by the SwaggerUI libraryi.

Expand Down
173 changes: 157 additions & 16 deletions docs/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Team Dev Server API
description: |-
version: 1.0
version: '1.0'

servers:
- url: http://localhost:4000/
Expand Down Expand Up @@ -35,15 +35,15 @@ paths:
get:
tags:
- user
summary: Get all users by first name if provided
summary: Get all users by name if provided
description: ''
operationId: getAllUsers
security:
- bearerAuth: []
parameters:
- name: firstName
- name: name
in: query
description: Search all users by first name if provided (case-sensitive and exact string matches only)
description: Search all users by name if provided. Name is case insensitive and will return matches for both first name and last name.
schema:
type: string
responses:
Expand Down Expand Up @@ -88,7 +88,6 @@ paths:

'400':
description: Invalid username/password supplied

/users/{id}:
get:
tags:
Expand Down Expand Up @@ -183,18 +182,78 @@ paths:
content:
type: string
responses:
201:
'201':
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
400:
'400':
description: fail
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
tags:
- post
summary: Update post
description: you can update your own post
operationId: editPost
security:
- bearerAuth: []
requestBody:
description: Updated post object
content:
application/json:
schema:
type: object
properties:
content:
type: string
responses:
'200':
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
'400':
description: fail
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags:
- post
summary: Delete post
description: you can delete your own post
operationId: deletePost
security:
- bearerAuth: []
requestBody:
description: Updated post object
content:
application/json:
schema:
type: object
properties:
content:
type: string
responses:
'200':
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
'500':
description: fail
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
get:
tags:
- post
Expand All @@ -204,13 +263,13 @@ paths:
security:
- bearerAuth: []
responses:
'200':
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Posts'
'401':
401:
description: fail
content:
application/json:
Expand Down Expand Up @@ -285,7 +344,22 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'

/comments:
get:
tags:
- comments
summary: Retrieve comments
description: only registered users can view these
operationId: getComments
security:
- bearerAuth: []
responses:
200:
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/Comments'
components:
securitySchemes:
bearerAuth:
Expand Down Expand Up @@ -405,11 +479,6 @@ components:
type: integer
content:
type: string
createdAt:
type: string
format: string
updatedAt:
type: string
format: string
author:
type: object
Expand All @@ -430,7 +499,79 @@ components:
type: string
profileImageUrl:
type: string

comments:
type: array
items:
type: object
properties:
id:
type: integer
postId:
type: integer
userId:
type: integer
content:
type: string
format: string
author:
type: object
properties:
firstName:
type: string
lastName:
type: string
createdAt:
type: string
format: string
updatedAt:
type: string
format: string
likes:
type: array
items:
type: object
properties:
id:
type: integer
userId:
type: integer
postId:
type: integer
createdAt:
type: string
format: string
updatedAt:
type: string

Comments:
type: object
properties:
status:
type: string
data:
type: object
properties:
comments:
type: array
items:
type: object
properties:
id:
type: integer
content:
type: string
postId:
type: integer
userId:
type: integer
author:
type: object
properties:
firstName:
type: string
lastName:
type: string

CreatedUser:
type: object
properties:
Expand Down
12 changes: 6 additions & 6 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# fly.toml file generated for team-dev-backend-api on 2022-11-30T11:30:34Z
# fly.toml app configuration file generated for boolean-team-dev-server on 2024-02-02T17:36:23+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "team-dev-backend-api"
app = 'boolean-team-dev-server'
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
primary_region = "lhr"

[env]
PORT = "8080"
Expand All @@ -12,9 +15,6 @@ processes = []
allowed_public_ports = []
auto_rollback = true

[deploy]
release_command = "npx prisma migrate deploy"

[[services]]
http_checks = []
internal_port = 8080
Expand Down
Loading