Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
45e53ec
Cleaned up CICD, removed fly, removed husky
dogezen Oct 21, 2024
f121283
Merged from upstream
dogezen Oct 24, 2024
573b4e1
Merge remote-tracking branch 'upstream/main'
dogezen Oct 24, 2024
bb55a66
Merge remote-tracking branch 'upstream/main'
dogezen Oct 24, 2024
f60740c
fixed package json merge conflict artifacts
dogezen Oct 24, 2024
b18ffb1
Super big contribution to the project
dogezen Oct 25, 2024
cee11c3
Merge pull request #2 from boolean-uk/1-user-registration-authregiste…
dogezen Oct 25, 2024
96fc9d1
Update prisma
gremble0 Oct 25, 2024
db1ebd9
Re-add .env.example
gremble0 Oct 25, 2024
775df4f
Merge pull request #4 from boolean-uk/3-gremble0-1-update_prisma
gremble0 Oct 25, 2024
6b3e7bb
Add some fields to database
gremble0 Oct 28, 2024
b553930
Added domain model for Post and edited getAll posts function to fetch…
Oct 28, 2024
2b2d4cb
Fix patch endpoint for /users
gremble0 Oct 28, 2024
9322b48
Use sendMessageRequest for errors
gremble0 Oct 28, 2024
8ca1979
Add /users delete endpoint
gremble0 Oct 28, 2024
51c62aa
Get all posts still under development, but working code, added an exa…
Oct 28, 2024
aeb75e0
editted the code slightly so it looks better
Oct 28, 2024
6636847
create method creates post now in db, there is connection between dat…
Oct 28, 2024
65108fe
Add delete to docs, add routing for delete users
gremble0 Oct 29, 2024
fb713ac
Add cascading deletes for delete users
gremble0 Oct 29, 2024
3cd4ecd
Add verification for delete users, update docs
gremble0 Oct 29, 2024
42a4965
Fix error handling for delete /users
gremble0 Oct 29, 2024
52031f9
Parse object to and from db for delete /users
gremble0 Oct 29, 2024
e283e2e
create and get works, refined code sligtly
Oct 29, 2024
216f231
Rename CreatedUser -> User in openapi docs
gremble0 Oct 29, 2024
810a9f8
Merge pull request #14 from boolean-uk/gremble0-#9-users_endpoints
gremble0 Oct 29, 2024
a90fc38
added search functionality for getAll, where one can pass a name as a…
Oct 29, 2024
379be80
removed console.log(s)
Oct 29, 2024
3514d01
Merge pull request #24 from boolean-uk/thomaafl-20-api-user-table-get…
thomaafl Oct 29, 2024
258a139
Add dates to user model
gremble0 Oct 29, 2024
dc06f33
Merge branch 'main' into gremble0-#23-separate_behavior_for_teachers_…
gremble0 Oct 29, 2024
abb90cb
githubUrl -> githubUsername
gremble0 Oct 29, 2024
3803587
Merge remote-tracking branch 'origin/panfi98&IbbiSecka-issue_13-GET&P…
alinjo Oct 29, 2024
89d42df
Only teachers can change user roles and cohorts
gremble0 Oct 29, 2024
5569b3e
Edited on response wgen getting all posts
Oct 29, 2024
c673620
Add jobTitle to model
gremble0 Oct 29, 2024
c9707d8
Work
Oct 29, 2024
6a572bc
Added functionality to delete post by ID
alinjo Oct 29, 2024
8060548
Merge pull request #26 from boolean-uk/gremble0-#23-separate_behavior…
gremble0 Oct 29, 2024
9d09997
Merge pull request #25 from boolean-uk/panfi98&IbbiSecka-issue_13-GET…
thomaafl Oct 29, 2024
b6860ba
Merge branch 'main' into 16-api-post-table---delete-post
Oct 29, 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
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ PORT=4000
DATABASE_URL="<your_database_url>?schema=prisma"
SHADOW_DATABASE_URL="<your_shadow_database_url>?schema=shadow"
JWT_SECRET="somesecurestring"
JWT_EXPIRY="24h"
JWT_EXPIRY="24h"
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: CI
on: [push, pull_request]
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
JWT_TOKEN: ${{ secrets.JWT_TOKEN }}
JWT_EXPIRY: ${{ secrets.JWT_EXPIRY }}
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -14,4 +10,3 @@ jobs:
node-version: 'lts/*'
- run: npm ci
- run: npx eslint src
- run: npx prisma migrate reset --force --skip-seed
21 changes: 0 additions & 21 deletions .github/workflows/deploy.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

36 changes: 0 additions & 36 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ The users that are seeded can be used to test the API endpoints and to log into

[todo]: <Update this with your ERD>

TODO
TODO - still not done
153 changes: 114 additions & 39 deletions docs/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/CreatedUser'
$ref: '#/components/schemas/User'
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 (case-sensitive and exact string matches only) can be full name or only last or first name
schema:
type: string
responses:
Expand Down Expand Up @@ -134,7 +134,7 @@ paths:
tags:
- user
summary: Update a user
description: Only users with a TEACHER role can update the cohortId or role. Users with Students role can only update their own details.
description: Only users with a TEACHER role can update the cohort_id or role. Users with Students role can only update their own details.
operationId: userUpdate
security:
- bearerAuth: []
Expand All @@ -157,13 +157,41 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/CreatedUser'
$ref: '#/components/schemas/User'
'401':
description: fail
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags:
- user
summary: Delete a user by ID
description: Removes a user from the system using their unique identifier
operationId: deleteById
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
description: Unique identifier of the user
schema:
type: integer
responses:
'201':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: User not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/posts:
post:
tags:
Expand Down Expand Up @@ -216,6 +244,55 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'

/posts/{id}:
delete:
tags:
- post
summary: Delete a post
description: Delete a post by its ID. This action can only be performed by the post owner or an admin.
operationId: deletePost
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
description: ID of the post to delete
schema:
type: integer
responses:
'200':
description: Post deleted successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
message:
type: string
example: Post deleted successfully
'400':
description: Invalid ID supplied
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Post not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/logs:
post:
tags:
Expand All @@ -234,7 +311,7 @@ paths:
properties:
date:
type: string
cohortId:
cohort_id:
type: integer
lines:
type: array
Expand Down Expand Up @@ -332,26 +409,6 @@ components:
items:
$ref: '#/components/schemas/User'

User:
type: object
properties:
id:
type: integer
email:
type: string
role:
type: string
cohortId:
type: integer
firstName:
type: string
lastName:
type: string
bio:
type: string
githubUrl:
type: string

CreateUser:
type: object
properties:
Expand All @@ -363,10 +420,16 @@ components:
type: string
bio:
type: string
githubUrl:
githubUsername:
type: string
password:
type: string
mobile:
type: string
specialism:
type: string
imageUrl:
type: string

UpdateUser:
type: object
Expand All @@ -375,7 +438,7 @@ components:
type: string
password:
type: string
cohortId:
cohort_id:
type: integer
role:
type: string
Expand All @@ -385,7 +448,13 @@ components:
type: string
bio:
type: string
githubUrl:
githubUsername:
type: string
mobile:
type: string
specialism:
type: string
imageUrl:
type: string

Posts:
Expand Down Expand Up @@ -416,7 +485,7 @@ components:
properties:
id:
type: integer
cohortId:
cohort_id:
type: integer
role:
type: string
Expand All @@ -426,12 +495,12 @@ components:
type: string
bio:
type: string
githubUrl:
githubUsername:
type: string
profileImageUrl:
type: string
CreatedUser:

User:
type: object
properties:
status:
Expand All @@ -445,7 +514,7 @@ components:
type: integer
email:
type: string
cohortId:
cohort_id:
type: integer
role:
type: string
Expand All @@ -455,7 +524,13 @@ components:
type: string
bio:
type: string
githubUrl:
githubUsername:
type: string
mobile:
type: string
specialism:
type: string
imageUrl:
type: string
login:
type: object
Expand All @@ -480,7 +555,7 @@ components:
type: integer
email:
type: string
cohortId:
cohort_id:
type: integer
role:
type: string
Expand All @@ -490,7 +565,7 @@ components:
type: string
bio:
type: string
githubUrl:
githubUsername:
type: string
Error:
type: object
Expand All @@ -513,7 +588,7 @@ components:
properties:
id:
type: integer
cohortId:
cohort_id:
type: integer
date:
type: string
Expand Down
Loading