Sprava eventu a organizaci

This commit is contained in:
Michal Kváček
2023-09-20 13:26:13 +02:00
parent 6fbaef4a1e
commit 8c3c5ee48d
42 changed files with 624 additions and 56 deletions
+11
View File
@@ -9,6 +9,12 @@ fragment aircraftFullInfo on Aircraft {
manufacturer
photoUrl
seats
createdById
organization {
id
name
}
}
`;
@@ -17,5 +23,10 @@ fragment aircraftBasicInfo on Aircraft {
id
callSign
manufacturer
organization {
id
name
}
}
`;
+4
View File
@@ -21,6 +21,10 @@ fragment flightListInfo on Flight {
}
}
event {
name
}
takeoffAirport {
...airportInfo
}
+31
View File
@@ -0,0 +1,31 @@
import gql from "graphql-tag";
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft";
export const FRAGMENT_ORGANIZATION_LIST_INFO = gql`
fragment organizationListInfo on Organization {
id
name
}
`;
export const FRAGMENT_ORGANIZATION_FULL_INFO = gql`
fragment organizationFullInfo on Organization {
id
name
createdById
users {
id
name
email
avatarImageUrl
}
aircrafts {
...aircraftBasicInfo
}
}
${FRAGMENT_AIRCRAFT_BASIC_INFO}
`;
// TODO: na info o userovi pouzit fragment - stejne jako v mutaci na pridani/odebrani usera z organizace
+54
View File
@@ -0,0 +1,54 @@
import gql from "graphql-tag";
import {FRAGMENT_ORGANIZATION_FULL_INFO} from "src/graphql/fragments/organization";
export const CREATE_ORGANIZATION = gql`
mutation createOrganization($input: CreateOrganizationInput!) {
createOrganization(input: $input) {
...organizationFullInfo
}
}
${FRAGMENT_ORGANIZATION_FULL_INFO}
`;
export const EDIT_ORGANIZATION = gql`
mutation editOrganization($id: Int!, $input: EditOrganizationInput!) {
editOrganization(id: $id, input: $input) {
...organizationFullInfo
}
}
${FRAGMENT_ORGANIZATION_FULL_INFO}
`;
export const ADD_USER_TO_ORGANIZATION = gql`
mutation addToOrganization($organizationId: Int!) {
addToOrganization(organizationId: $organizationId) {
users {
id
name
email
avatarImageUrl
}
}
}`;
export const REMOVE_USER_FROM_ORGANIZATION = gql`
mutation removeFromOrganization($organizationId: Int!) {
removeFromOrganization(organizationId: $organizationId) {
users {
id
name
email
avatarImageUrl
}
}
}`;
// export const DELETE_ORGANIZATION = gql`
// mutation deleteOrganization($id: Int!) {
// deleteOrganization(id: $id) {
// id
// }
// }
// `;
+22
View File
@@ -0,0 +1,22 @@
import gql from "graphql-tag";
import {FRAGMENT_ORGANIZATION_FULL_INFO, FRAGMENT_ORGANIZATION_LIST_INFO} from "src/graphql/fragments/organization";
export const ORGANIZATIONS_LIST = gql`
query organizationsList {
organizations {
...organizationListInfo
}
}
${FRAGMENT_ORGANIZATION_LIST_INFO}
`;
export const ORGANIZATION_DETAIL = gql`
query organization($id: Int!) {
organization(id: $id) {
...organizationFullInfo
}
}
${FRAGMENT_ORGANIZATION_FULL_INFO}
`;
+5
View File
@@ -16,6 +16,11 @@ export const LOGGED_USER_DETAIL = gql`
query loggedUserDetail {
loggedUser {
...userFullInfo
organizations {
id
name
}
}
}