mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { gql } from 'graphql-request'
|
|
import * as v from 'valibot'
|
|
import { dateSchema } from '../../schemas/typeConverter.schema'
|
|
import { hieroIdSchema, uuidv4Schema } from '../../schemas/typeGuard.schema'
|
|
|
|
/**
|
|
* Schema Definitions for graphql response
|
|
*/
|
|
export const communitySchema = v.object({
|
|
uuid: uuidv4Schema,
|
|
name: v.string('expect string type'),
|
|
hieroTopicId: v.nullish(hieroIdSchema),
|
|
foreign: v.boolean('expect boolean type'),
|
|
creationDate: dateSchema,
|
|
})
|
|
|
|
export type CommunityInput = v.InferInput<typeof communitySchema>
|
|
export type Community = v.InferOutput<typeof communitySchema>
|
|
|
|
// graphql query for getting home community in tune with community schema
|
|
export const homeCommunityGraphqlQuery = gql`
|
|
query {
|
|
homeCommunity {
|
|
uuid
|
|
name
|
|
hieroTopicId
|
|
foreign
|
|
creationDate
|
|
}
|
|
}
|
|
`
|
|
|
|
export const setHomeCommunityTopicId = gql`
|
|
mutation ($uuid: String!, $hieroTopicId: String){
|
|
updateHomeCommunity(uuid: $uuid, hieroTopicId: $hieroTopicId) {
|
|
uuid
|
|
name
|
|
hieroTopicId
|
|
foreign
|
|
creationDate
|
|
}
|
|
}
|
|
`
|