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

Created endpoint for adding a character (backend) #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KhushMakadia4
Copy link
Collaborator

Status:

🚀 Ready

Description

Created a new backend endpoint called "createCharacter" using the tRPC mutation guidelines and tested it on the frontend using the console. Inside the endpoint, I created a new Prisma push object following the Character model in the Prisma schema.

Fixes hack4impact-uiuc/starter-projects#26

Todos

  • Created a new endpoint in server/api/routers/character.ts.
  • Tested new endpoint in index.tsx.
  • Next step is to integrate it into the frontend.

Screenshots

image
Mutation of the new character showing up on the console.

image
Update of the new character with the character list.

Copy link
Member

@gracewzhang gracewzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks great! there are a few merge conflicts to address, and double-check that your linter is working (I was thinking about the issue we were running into during last dev night, and I'm thinking/hoping that it's because we didn't npm i after pulling from main, which had an additional linting package installed)

Comment on lines +13 to +17

import { api } from '../utils/api';

const Home: NextPage = () => {
const characters = api.characterRouter.getCharacters.useQuery()?.data;
const characters = api.characterRouter.getCharacters.useQuery()?.data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to check for unnecessary/accidental changes when opening a PR!

@@ -12,6 +12,7 @@ import {
import ButtonTemp from './Button';
import FormInput from './FormInput';


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants