Giter VIP home page Giter VIP logo

Comments (5)

jfeo avatar jfeo commented on July 21, 2024

It's on its way #2, hopefully tonight or tomorrow

from artswipe-backend.

frebliklo avatar frebliklo commented on July 21, 2024

Cool 😄Næste er vel at tænkte på nogle Mutations så 😉

from artswipe-backend.

jfeo avatar jfeo commented on July 21, 2024

Jeg har indført en swipe-mutation

type Swipe {
  culture: CultureItem!
  user: User!
  choice: Boolean!
  timestamp: Int!
}

mutation swipeCulture(user: ID!, culture: ID!, choice: Boolean!): Swipe!

from artswipe-backend.

jfeo avatar jfeo commented on July 21, 2024

Den kan nu testes live på '/graphiql' end-pointet. '/graphql' end-pointet er råt graphql der kan sendes med Content-Type: application/graphql.
Der kræves "Authentication-Token" HTTP-header, at tilgå den. Der er et simpelt registrerings/loginflow.

POST /register (kræver lige nu gentagelse af pw)
{ "email": "", "first_name":"", "last_name":"", "password":"", "password_confirm":"" }
response:
{ "response": { "user": { "authentication_token": "...", "id": "N" } } }

POST /login
{ "email": "", "password":"" }
response:
{ "response": { "user": { "authentication_token": "...", "id": "N" } } }

from artswipe-backend.

jfeo avatar jfeo commented on July 21, 2024

@frebliklo Følgende skema er live nu.

Der er selvfølgeligt stadig nogle forskelle, mht. nullable felter, og hele strukturen med unions skal måske gentænkes... Men det kan i hvert fald afprøves ;-)

schema {
  query: Query
  mutation: Mutation
}

type AuthError {
  message: String!
}

type AuthToken {
  value: String!
}

union AuthorizedCultureItems = CultureList | AuthError

union AuthorizedMatches = MatchList | AuthError

union AuthorizedSwipe = Swipe | AuthError

union AuthorizedSwipes = SwipeList | AuthError

union AuthorizedToken = AuthToken | AuthError

union AuthorizedUser = User | AuthError

type CreateUserError {
  message: String!
}

union CreateUserResult = User | CreateUserError

type CultureItem {
  id: ID!
  localId: String
  title: String
  image: JSONString
  upvotes: Int
  downvotes: Int
  swipes: [Swipe]
}

type CultureList {
  items: [CultureItem]!
}

scalar DateTime

scalar JSONString

type Match {
  author: User!
  matchUser: User!
  seen: Boolean!
  read: Boolean!
  createdAt: Int!
}

type MatchList {
  matches: [Match]
}

type Mutation {
  swipeCulture(choice: Boolean!, culture: ID!, token: String!): AuthorizedSwipe
  createUser(email: String!, firstName: String!, lastName: String!, password: String!): CreateUserResult
  obtainToken(email: String!, password: String!): AuthorizedToken
}

type Query {
  user(token: String!): AuthorizedUser
  matches(token: String!): AuthorizedMatches
  culture(count: Int, token: String!): AuthorizedCultureItems
  swipes(token: String!): AuthorizedSwipes
}

type Swipe {
  choice: Boolean
  timestamp: DateTime
  user: User
  culture: CultureItem
}

type SwipeList {
  swipes: [Swipe]
}

type User {
  id: ID!
  firstName: String
  lastName: String
  email: String
  active: Boolean
  facebookLinked: Boolean
  googleLinked: Boolean
  avatarUrl: String
  roles: String
  swipes: [Swipe]
}

from artswipe-backend.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.