Implement 'description', 'groupType', and 'actionRadius' in 'CreateGroup'

This commit is contained in:
Wolfgang Huß 2022-08-03 11:50:56 +02:00
parent 45558f06dd
commit 520598c897
5 changed files with 64 additions and 34 deletions

View File

@ -6,6 +6,9 @@ export const createGroupMutation = gql`
$name: String!,
$slug: String,
$about: String,
$description: String!,
$groupType: GroupType!,
$actionRadius: GroupActionRadius!,
$categoryIds: [ID]
) {
CreateGroup(
@ -13,12 +16,18 @@ export const createGroupMutation = gql`
name: $name
slug: $slug
about: $about
description: $description
groupType: $groupType
actionRadius: $actionRadius
categoryIds: $categoryIds
) {
id
name
slug
about
description
groupType
actionRadius
disabled
deleted
owner {

View File

@ -69,6 +69,9 @@ describe('slugifyMiddleware', () => {
...variables,
name: 'The Best Group',
about: 'Some about',
description: 'Some description',
groupType: 'closed',
actionRadius: 'national',
categoryIds,
}
})
@ -83,7 +86,12 @@ describe('slugifyMiddleware', () => {
).resolves.toMatchObject({
data: {
CreateGroup: {
name: 'The Best Group',
slug: 'the-best-group',
about: 'Some about',
description: 'Some description',
groupType: 'closed',
actionRadius: 'national',
},
},
})

View File

@ -4,19 +4,44 @@ export default {
id: { type: 'string', primary: true, default: uuid }, // TODO: should be type: 'uuid' but simplified for our tests
name: { type: 'string', disallow: [null], min: 3 },
slug: { type: 'string', unique: 'true', regex: /^[a-z0-9_-]+$/, lowercase: true },
createdAt: {
type: 'string',
isoDate: true,
required: true,
default: () => new Date().toISOString(),
},
updatedAt: {
type: 'string',
isoDate: true,
required: true,
default: () => new Date().toISOString(),
},
deleted: { type: 'boolean', default: false },
disabled: { type: 'boolean', default: false },
avatar: {
type: 'relationship',
relationship: 'AVATAR_IMAGE',
target: 'Image',
direction: 'out',
},
deleted: { type: 'boolean', default: false },
disabled: { type: 'boolean', default: false },
wasSeeded: 'boolean', // Wolle: used or needed?
locationName: { type: 'string', allow: [null] },
about: { type: 'string', allow: [null, ''] }, // Wolle: null?
description: { type: 'string', allow: [null, ''] }, // Wolle: null? HTML with Tiptap, similar to post content, wie bei Posts "content: { type: 'string', disallow: [null], min: 3 },"?
about: { type: 'string', allow: [null, ''] },
description: { type: 'string', disallow: [null], min: 100 },
descriptionExcerpt: { type: 'string', allow: [null] },
groupType: { type: 'string', default: 'public' },
actionRadius: { type: 'string', default: 'regional' },
locationName: { type: 'string', allow: [null] },
wasSeeded: 'boolean', // Wolle: used or needed?
owner: {
type: 'relationship',
relationship: 'OWNS',
target: 'User',
direction: 'in',
},
// Wolle: followedBy: {
// type: 'relationship',
// relationship: 'FOLLOWS',
@ -26,26 +51,9 @@ export default {
// createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
// },
// },
owner: {
type: 'relationship',
relationship: 'OWNS',
target: 'User',
direction: 'in',
},
// Wolle: correct this way?
// members: { type: 'relationship', relationship: 'MEMBERS', target: 'User', direction: 'out' },
// Wolle: needed? lastActiveAt: { type: 'string', isoDate: true },
createdAt: {
type: 'string',
isoDate: true,
default: () => new Date().toISOString(),
},
updatedAt: {
type: 'string',
isoDate: true,
required: true,
default: () => new Date().toISOString(),
},
// Wolle: emoted: {
// type: 'relationships',
// relationship: 'EMOTED',

View File

@ -252,6 +252,9 @@ describe('CreateGroup', () => {
name: 'The Best Group',
slug: 'the-group',
about: 'We will change the world!',
description: 'Some description',
groupType: 'public',
actionRadius: 'regional',
categoryIds,
}
})
@ -272,7 +275,6 @@ describe('CreateGroup', () => {
const expected = {
data: {
CreateGroup: {
// Wolle: id: 'g589',
name: 'The Best Group',
slug: 'the-group',
about: 'We will change the world!',

View File

@ -19,27 +19,28 @@ enum _GroupOrdering {
type Group {
id: ID!
name: String # title
name: String! # title
slug: String!
createdAt: String
updatedAt: String
createdAt: String!
updatedAt: String!
deleted: Boolean
disabled: Boolean
avatar: Image @relation(name: "AVATAR_IMAGE", direction: "OUT")
about: String # goal
description: String!
groupType: GroupType!
actionRadius: GroupActionRadius!
location: Location @cypher(statement: "MATCH (this)-[:IS_IN]->(l:Location) RETURN l")
locationName: String
about: String # goal
description: String
groupType: GroupType
actionRadius: GroupActionRadius
categories: [Category] @relation(name: "CATEGORIZED", direction: "OUT")
# Wolle: needed?
socialMedia: [SocialMedia]! @relation(name: "OWNED_BY", direction: "IN")
# socialMedia: [SocialMedia]! @relation(name: "OWNED_BY", direction: "IN")
owner: User @relation(name: "OWNS", direction: "IN")
@ -213,10 +214,12 @@ type Mutation {
name: String!
slug: String
avatar: ImageInput
locationName: String
about: String
description: String
description: String!
groupType: GroupType!
actionRadius: GroupActionRadius!
categoryIds: [ID]
locationName: String
): # Wolle: add group settings
# Wolle:
# showShoutsPublicly: Boolean