SE701-T5 / Frontend

This is the frontend repo of Uni-forum, associated with the University of Auckland, SOFTENG701. This repo will be linked to Netlify for ease of deployment and code review
MIT License
1 stars 22 forks source link

Connect to Backend #84

Open frasermcc9 opened 2 years ago

frasermcc9 commented 2 years ago

Description

We need to connect the frontend with the backend.

Tasks

GlockTian commented 2 years ago

see below

wshe874 commented 2 years ago

Peter's list is very comprehensive, to add on top it , we need some GET requests for the NavBar:

wshe874 commented 2 years ago

Currently available endpoints:

" /api/v1/posts"

"/api/v1/posts/:id"

"/api/v1/posts/:id/comments"

"/api/v1/posts/:id/comments/:id"

"'/api/v1/users"

'/api/v1/users/login'

'/api/v1/users/logout'

'/api/v1/users/:id'

'/api/v1/reset'

'/api/v1/resample'

for detailed request body structure or response structure, see backend code

GlockTian commented 2 years ago

login page and Signup page and ForgetPassword page:

[API Required]

login: POST

signup: POST

forget password: POST

const signUp ={
    email: 'test@gmail.com',
    username: 'Ronald',
    passwordHash: ''
}

const login = {
    email: '',
    passwordHash: '',
}

//send a link to email to reset password :) Good Luck
const forgetPassword = {
    email: ''
}

Home Page:

[GET API Required] list of popular Communities

[GET API Required] list of popular posts in preview form

Community Page:

this is the page for a single community. It probably needs the id of the community in its path

const communityInfo = {
    name: "good name",
    description: "",
    img: "<https://picsum.photos/400/300>"
}

Community Action:

[POST API Required] we probably need request to join and unjoined a community

[GET API Required] list of posts in preview under the particular community

New Community Page

Note: we also need to upload a image here

[POST API Required] create a new community

const newCommunity =   {
    name: "good name",
    description: "",
    img: "<https://picsum.photos/400/300>"
}

I don't understand what this page is doing:

Communities page:

[GET API Required] show a list of communities

[GET API Required] show a list of communities by searching it. parameter=”SearchText”

Community Action:

[POST API Required] we probably need request to join and unjoined a community

Posts Page

[GET API Required] Get a list of posts

[GET API Required] show a list of posts by searching it

Post detail pages:

[GET API Required] /post/:id to get detailed post information

Post Action

[POST API Required] There is also where you can upvote or downvote a comment

[POST API Required] You can create new comments for the post.

New Post Page

Note: we also need to upload an image here

A new post can have

const newPost = {
    title: "",
    community:"", //something that points to an existing community/forum
    text: "",
    img: "" // a single image
}

Schema Section:

Post:

{
    id:"", // mongoID
    communityId: "", //id  link to community schema
    userId: "", // id link to user schema
    time: "23:57", // unix time maybe?
    title: "sjngosnhpmre",
    text:  "I love react and react libraries but I have never used Semantic UI...  I heard from a teammate  that it’s pretty easy to use and has a lot of documentation so hopefully I’ll be fine. Any tips...",
    images: [""],// list of images url
    upvotes: 534,
    downvotes: 352,
    commentsArray:[
        {
            id:"",// mongoID
            comment: "I love react and react libraries but I have never used Semantic UI...  I heard from a teammate that it’s pretty easy to use and has a lot of documentation so hopefully I’ll be fine. Any tips for using this new frontend framework?",
            commentUpvotes: 456,
            commentDownvotes: 352,
            commentUpi: "shr23456",
            commentTime: "23:57" // or UNIX time
        },
        ...
    ]
}

Comments

{
  id:"",// mongoID
    comment: "I love react and react libraries but I have never used Semantic UI...  I heard from a teammate that it’s pretty easy to use and has a lot of documentation so hopefully I’ll be fine. Any tips for using this new frontend framework?",
    commentUpvotes: 456,
    commentDownvotes: 352,
    commentUpi: "shr23456",
    commentTime: "23:57" // or UNIX time??
}

Community

{
  id: "", // mongoID
  community: "SOFTENG 701",// mongoID
  members: "150",
  description:
    "A fun project-driven course emphasising teamwork. This is a very cool course where you can learn lots of things from peers and lecturers.",
  image: "<https://picsum.photos/400/300>"
}

User

{
  id: "",
  email: "",
  username: "",
  passwordHash: "",
  posts:[], // list of post id
  communities:[] // list of community id
}