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

Ticket: Hooking up AddSenior #49

Open
3 tasks
sgilfeather opened this issue Mar 6, 2023 · 0 comments
Open
3 tasks

Ticket: Hooking up AddSenior #49

sgilfeather opened this issue Mar 6, 2023 · 0 comments
Assignees
Labels
ticket Weekly developer ticket

Comments

@sgilfeather
Copy link
Contributor

sgilfeather commented Mar 6, 2023

🎯 Due April 12th, 2023
Taarika Bala, Siara Small, Alex Lee, Alyssa Williams

Your task for this week and a half is to add functionality to the AddSenior page, so that you can generate a new model and store it on submission of the form!

Specifically, you'll be writing the handleSubmit functions specified in add-senior.tsx. Don't worry about the event parameter passed in; you'll be using the properties in seniorData to construct a new model.

  • First, you'll want to retrieve a list of the current Students, represented by User models.add-senior.tsx has a dropdown of potential student names; so, replace the dropData parameter in the <AddProfile> with these names!
  • Then, build your newSenior model. You'll populate fields like name and location with the data passed into the handleSubmit() function. Other fields are more specific:StudentIDs and Students will describe all associated Users. A new Senior has no files. Furthermore, on creation of a new senior, you'll want to give them a unique folder in Google Drive...
  • Use the Google Drive API to create a new folder under the JumboCode gmail account. Use the code shown here in the Google Drive API, under Node.js, for reference on how to create a new folder: here. Save the file.data.id value: this is what you'll store in the Senior model's folder field, so that Senior's files can be retrieved later.

Finally, create and push your new model. You'll be using your function written in src/pages/api/senior/add.ts. Check out the handleSubmit() code snippet below from refine.dev on how to use your routes.

  function handleSubmit(e) {
    e.preventDefault();
    const postData = async () => {
      const data = {
        title: title,
        post: post,
      };

      const response = await fetch("/api/post", {
        method: "POST",
        body: JSON.stringify(data),
      });
      return response.json();
    };
    postData().then((data) => {
      alert(data.message);
    });
  }

We anticipate that the Google Drive part will be a little trickier– reach out to me or Michael if you have any questions.

@sgilfeather sgilfeather assigned sgilfeather and locmai1 and unassigned sgilfeather Mar 6, 2023
@sgilfeather sgilfeather added the ticket Weekly developer ticket label Mar 6, 2023
@sgilfeather sgilfeather changed the title Ticket: Hooking up AddSenior Ticket: Hooking up AddStudent and AddSenior Apr 5, 2023
@sgilfeather sgilfeather changed the title Ticket: Hooking up AddStudent and AddSenior Ticket: Hooking up AddStudent Apr 5, 2023
@sgilfeather sgilfeather changed the title Ticket: Hooking up AddStudent Ticket: Hooking up AddStudent and AddSenior Apr 5, 2023
@sgilfeather sgilfeather assigned taarikabala and unassigned locmai1 Apr 5, 2023
@sgilfeather sgilfeather changed the title Ticket: Hooking up AddStudent and AddSenior Ticket: Hooking up AddSenior Apr 5, 2023
nickbar01234 pushed a commit that referenced this issue Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ticket Weekly developer ticket
Projects
None yet
Development

No branches or pull requests

3 participants