{"id":22083233,"url":"https://github.com/johnserrano15/graphql-backend","last_synced_at":"2025-09-09T23:32:26.726Z","repository":{"id":44318670,"uuid":"201343945","full_name":"johnserrano15/graphql-backend","owner":"johnserrano15","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-11T01:20:54.000Z","size":497,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T04:44:09.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnserrano15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-08T22:02:36.000Z","updated_at":"2019-08-08T22:05:04.000Z","dependencies_parsed_at":"2023-01-26T12:31:09.268Z","dependency_job_id":null,"html_url":"https://github.com/johnserrano15/graphql-backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnserrano15%2Fgraphql-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnserrano15%2Fgraphql-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnserrano15%2Fgraphql-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnserrano15%2Fgraphql-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnserrano15","download_url":"https://codeload.github.com/johnserrano15/graphql-backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245170439,"owners_count":20572066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T00:12:06.991Z","updated_at":"2025-03-23T21:23:55.909Z","avatar_url":"https://github.com/johnserrano15.png","language":"JavaScript","readme":"# Queries ejecutadas en el curso en GraphiQL\n\n## Get all courses\n\n```graphql\n{\n  getCourses {\n    title\n    description\n  }\n}\n```\n\n## Get course ID\n\n```graphql\n{\n  getCourse(id: \"oqeded2\") {\n    _id\n    title\n    description\n  }\n}\n```\n\n## Mutation\n\n```graphql\nmutation {\n  createCourse(input: {\n   \ttitle: \"Nuevo curso\"\n    description: \"Description new\"\n    topic: \"diseño\"\n  }){\n    _id\n    title\n    description\n  }\n}\n```\n\n## Mutation Edit\n\n```graphql\nmutation {\n  editCourse(_id: \"5d499e87f05e5225c8c93db0\", input: {\n    title: \"Curso editado\"\n    teacher: \"John Serrano\"\n  }){\n    title\n    teacher\n  }\n}\n```\n\n## Mutation Delete\n\n```graphql\nmutation {\n  deleteCourse(_id: \"5d49a689956e731fb00367f1\")\n}\n```\n\n## Mutation Nested Types\n\n```graphql\nmutation {\n  addPeople(courseID: \"5d49935b7389141d5c7c7172\", \n    personID: \"5d49a82087948f2aac0a3b0a\"){\n    _id\n    title\n  }\n}\n```\n\n## Resolver types\n\n```graphql\n{\n  getCourses {\n    _id\n    title\n    description\n    teacher\n    people {\n      _id\n      name\n      email\n    }\n  }\n}\n```\n\n## Alias\n\n```graphql\n{\n  AllCourses: getCourses {\n    _id\n    title\n    description\n  }\n  \n  Course1: getCourse(id: \"5d4993c93b833e1d5c0929d0\"){\n    title\n    description\n  }\n  \n  Course2: getCourse(id: \"5d499e87f05e5225c8c93db0\"){\n    title\n    description\n    topic\n  }\n  \n  \n  Course3: getCourse(id: \"5d499e87f05e5225c8c93db0\"){\n    title\n    description\n    people {\n      name\n      email\n    }\n  }\n}\n```\n\n## Fragment\n\n```graphql\n{\n  AllCourses: getCourses {\n    ...CourseFields\n  }\n  \n  Course1: getCourse(id: \"5d4993c93b833e1d5c0929d0\"){\n    ...CourseFields\n    teacher\n  }\n  \n  Course2: getCourse(id: \"5d499e87f05e5225c8c93db0\"){\n    ...CourseFields\n    topic\n  }\n}\n\nfragment CourseFields on Course {\n\t_id\n  title\n  description\n  people {\n    _id\n    name\n  }\n}\n```\n\n## Variables\n\n```graphql\nquery GetCourse2 ($course: ID!) {\n  getCourse(id: $course){\n   _id\n    title\n    people{\n      _id\n      name\n    }\n  }\n}\n```\n\n* Requiere un objeto JSON como:\n\n```json\n{\n  \"course\": \"5cb4b8ce75f954a0585f7be3\"\n}\n```\n---\n\n```graphql\nmutation AddPersonToCourse ($course: ID!, $person: ID!){\n  addPeople(courseID: $course, personID: $person) {\n    _id\n    title\n  }\n}\n```\n\n* Requiere un objeto JSON como:\n\n```json\n{\n  \"course\": \"5d499e87f05e5225c8c93db0\",\n  \"person\": \"5d49a82087948f2aac0a3b0a\"\n}\n```\n\n## Enums\n```graphql\nmutation CreateNewCourse($createInput: CourseInput!) {\n  createCourse(input: $createInput) {\n    title\n    description\n  }\n}\n```\n\n* Requiere un objeto JSON como:\n\n```json\n{\n  \"createInput\": {\n    \"title\": \"Course new example\",\n    \"teacher\": \"My teacher\",\n    \"description\": \"my description\",\n    \"topic\": \"marketing\",\n    \"level\": \"principiante\"\n  }\n}\n```\n\n## Interfaces - Tipo Monitor\n``` graphql\nmutation CreateNewMonitor($createInput: PersonInput!) {\n  createPerson(input: $createInput){\n    _id\n    name\n  }\n}\n```\n\n```graphql\n{\n  getPeople {\n    _id\n    name\n    email\n    ... on Monitor {\n      phone\n    }\n  }\n}\n```\n\n## Directivas @include and @skip\n``` graphql\nquery getPeopleDate($monitor: Boolean!) {\n  getPeople {\n    _id\n    name\n    email\n    ... on Monitor @include(if: $monitor){\n      phone\n    }\n  }\n}\n\nquery getPeopleDate($monitor: Boolean!, $avatar: Boolean!) {\n  getPeople {\n    _id\n    name\n    ... on Monitor @include(if: $monitor){\n      phone\n    }\n    ... on Student @skip(if: $avatar){\n      avatar\n      email\n    }\n  }\n}\n```\n\n* Requiere un objeto JSON como:\n\n```json\n{\n  \"monitor\": false,\n  \"avatar\": false\n}\n```\n\n## Unions\n``` graphql\n{\n  searchItems(keyword: \"title\") {\n    __typename\n    ... on Course {\n      _id\n      title\n      description\n    }\n    ... on Monitor {\n      _id\n      name\n      email\n    }\n    ... on Student {\n      _id\n      name\n      email\n    }\n  }\n}\n```\n\n\u003e *Nota se crearon los indexes -\u003e `db.courses.createIndex({ \"$**\": \"text\" }); db.students.createIndex({ \"$**\": \"text\" });`*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnserrano15%2Fgraphql-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnserrano15%2Fgraphql-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnserrano15%2Fgraphql-backend/lists"}