This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
using UnityEngine.Serialization; | |
public class Movement : MonoBehaviour | |
{ | |
[SerializeField] private float speed = 8f; | |
private Vector2 _currentVelocity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using Unity.VisualScripting; | |
using UnityEngine; | |
public class Snake : MonoBehaviour // Pilnować nazwy klasy aby zgadzała się z nazwą pliku - inaczej nie będzie działać | |
{ // klasa dziedziczy po MonoBehaviour | |
[SerializeField]//DEKORATOR - w unity tworzy okno ktore porzyjmie wartość |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query: { | |
authors: () => { | |
return authorModel.find() | |
}, | |
author: (root, args) => { | |
const id = args.id; | |
return authorModel.findOne({id: id}); | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Mutation { | |
addAuthor(name: String!, age: Int!, Books: [String]!): Author | |
deleteAuthor(id: String!):Author | |
updateAuthor(id:String!,name: String!):Author | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mutation: { | |
addAuthor: (root, {name, age, Books}) => { | |
const author = new authorModel({name, age, Books}) | |
return author.save() | |
}, | |
deleteAuthor: (root, {id}) => { | |
return authorModel.findOneAndRemove({id: id}) | |
}, | |
updateAuthor:(root, {id, name})=> { | |
return authorModel.findOneAndUpdate({id:id}, {name}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mutation: { | |
addAuthor: (root, {name, age, Books}) => { | |
const author = new authorModel({name, age, Books}) | |
return author.save() | |
}, | |
deleteAuthor: (root, {id}) => { | |
return authorModel.findOneAndRemove({id: id}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Mutation { | |
addAuthor(name: String!, age: Int!, Books: [String]!): Author | |
deleteAuthor(id: String!):Author | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {makeExecutableSchema, addMockFunctionsToSchema} from 'graphql-tools'; | |
import resolvers from './resolvers' | |
const typeDefs = ` | |
type Author { | |
id: Int, | |
age: Int | |
name: String, | |
Books: [String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongoose from 'mongoose' | |
import authorModel from './models/author' | |
const resolvers = { | |
Query: { | |
authors: () => { | |
return authors | |
}, | |
author: (root, args) => { |
NewerOlder