Skip to content

Commit

Permalink
Merge pull request #3 from rice-apps/scheduler
Browse files Browse the repository at this point in the history
Added typedef for butterfly
  • Loading branch information
victor-xie authored Oct 21, 2023
2 parents 531d69c + 16bfea8 commit 81c51ac
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions hmns-app/server/graphql/resolvers/ButterflyResolvers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { User } from '../../models/User';

export const userResolvers = {
Query: {
getUser: async (_: any, { id }: { id: string }) => {
return await User.findById(id);
},
users: async () => {
return await User.find();
}
},
Mutation: {
createUser: async (_: any, { name }: { name: string }) => {
const user = new User({ name });
await user.save();
return user;
},
}
};
19 changes: 19 additions & 0 deletions hmns-app/server/graphql/typeDefs/ButterflyTypeDefs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { gql } from 'apollo-server-express';

export const ButterflyTypeDefs = gql`
type Butterfly {
id: ID!
commonName: String!
scientificName: String!
photoUrl: [String]!
location: String
family: [String]
funFact: String
priority: String
}
type Query {
getButterfly(id: ID!): Butterfly
}
`;

0 comments on commit 81c51ac

Please sign in to comment.