Skip to content

Instantly share code, notes, and snippets.

View wojciech-bilicki's full-sized avatar

Wojciech Bilicki wojciech-bilicki

  • Oke Software
  • Gdańsk
View GitHub Profile
using System;
using UnityEngine;
using UnityEngine.Serialization;
public class Movement : MonoBehaviour
{
[SerializeField] private float speed = 8f;
private Vector2 _currentVelocity;
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ść
Query: {
authors: () => {
return authorModel.find()
},
author: (root, args) => {
const id = args.id;
return authorModel.findOne({id: id});
}
},
@wojciech-bilicki
wojciech-bilicki / schema.js
Created April 12, 2018 08:21
update author
type Mutation {
addAuthor(name: String!, age: Int!, Books: [String]!): Author
deleteAuthor(id: String!):Author
updateAuthor(id:String!,name: String!):Author
}
@wojciech-bilicki
wojciech-bilicki / resolvers.js
Created April 12, 2018 08:21
update author
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})
Mutation: {
addAuthor: (root, {name, age, Books}) => {
const author = new authorModel({name, age, Books})
return author.save()
},
deleteAuthor: (root, {id}) => {
return authorModel.findOneAndRemove({id: id})
}
}
@wojciech-bilicki
wojciech-bilicki / schema.js
Created April 12, 2018 07:57
delete author
type Mutation {
addAuthor(name: String!, age: Int!, Books: [String]!): Author
deleteAuthor(id: String!):Author
}
@wojciech-bilicki
wojciech-bilicki / schema.js
Created April 12, 2018 07:47
mandatory fields
import {makeExecutableSchema, addMockFunctionsToSchema} from 'graphql-tools';
import resolvers from './resolvers'
const typeDefs = `
type Author {
id: Int,
age: Int
name: String,
Books: [String]
@wojciech-bilicki
wojciech-bilicki / resolvers.js
Last active April 12, 2018 07:30
with Mutations
import mongoose from 'mongoose'
import authorModel from './models/author'
const resolvers = {
Query: {
authors: () => {
return authors
},
author: (root, args) => {
import mongoose from mongoose;
import uuid from 'node-uuid';
const schema = mongoose.Schema;
const authorSchema = new schema({
id: {type: String, default: uuid.v1},
name: String,
age: Number,
Books: [String]