Update schema for projects

This commit is contained in:
Ramon Wenger 2021-09-02 09:36:17 +02:00
parent 3f5d705877
commit 96ed807b2b
5 changed files with 57 additions and 64 deletions

View File

@ -1,35 +1,35 @@
import {getMinimalMe} from '../../../support/helpers';
describe('New project', () => {
const MeQuery = getMinimalMe({isTeacher: false});
const schoolClass = MeQuery.me.selectedClass;
const operations = {
ProjectsQuery: {
projects: {
edges: [
{
node: {
id: 'UHJvamVjdE5vZGU6NjY=',
title: 'Some random title',
appearance: 'blue',
description: 'This description rocks',
slug: 'some-random-title',
objectives: 'Git gud',
final: false,
student: {
firstName: 'Rachel',
lastName: 'Green',
id: 'VXNlck5vZGU6NQ==',
avatarUrl: '',
},
entriesCount: 0,
},
projects: [
{
id: 'UHJvamVjdE5vZGU6NjY=',
title: 'Some random title',
appearance: 'blue',
description: 'This description rocks',
slug: 'some-random-title',
objectives: 'Git gud',
final: false,
schoolClass,
student: {
firstName: 'Rachel',
lastName: 'Green',
id: 'VXNlck5vZGU6NQ==',
avatarUrl: '',
},
],
},
},
MeQuery: {
me: {},
entriesCount: 0,
},
],
},
MeQuery,
AddProject: variables => ({
addProject: {
project: Object.assign({}, variables.input.project),
project: Object.assign({}, variables.input.project, {schoolClass}),
errors: null,
__typename: 'AddProjectPayload',
},

View File

@ -7,30 +7,26 @@ describe('Project Entry', () => {
},
},
ProjectsQuery: {
projects: {
edges: [{
node: {
id: 'UHJvamVjdE5vZGU6MzM=',
title: 'Groot',
appearance: 'red',
'description': 'I am Groot',
'slug': 'groot',
'objectives': 'Be Groot\nBe awesome',
'final': false,
'student': {
'firstName': 'Rachel',
'lastName': 'Green',
'id': 'VXNlck5vZGU6NQ==',
'avatarUrl': '',
'__typename': 'UserNode',
},
'entriesCount': 2,
'__typename': 'ProjectNode',
projects: [
{
id: 'UHJvamVjdE5vZGU6MzM=',
title: 'Groot',
appearance: 'red',
'description': 'I am Groot',
'slug': 'groot',
'objectives': 'Be Groot\nBe awesome',
'final': false,
'student': {
'firstName': 'Rachel',
'lastName': 'Green',
'id': 'VXNlck5vZGU6NQ==',
'avatarUrl': '',
'__typename': 'UserNode',
},
'__typename': 'ProjectNodeEdge',
}],
'__typename': 'ProjectNodeConnection',
},
'entriesCount': 2,
'__typename': 'ProjectNode',
},
],
},
ProjectQuery: {
'project': {
@ -85,8 +81,7 @@ describe('Project Entry', () => {
}),
DeleteProjectEntry: {
deleteProjectEntry: {
success: true,
__typename: 'DeleteProjectEntryPayload',
success: true
},
},
};

View File

@ -11,7 +11,15 @@
<script>
export default {
props: ['value', 'index'],
props: {
value: {
type: Object,
default: null,
validator(value) {
return value.hasOwnProperty('text');
}
}
},
computed: {
text() {
@ -22,7 +30,7 @@
</script>
<style scoped lang="scss">
@import "@/styles/_variables.scss";
@import "~styles/helpers";
.text-form {
&__input {

View File

@ -33,7 +33,7 @@ class ProjectEntryNode(DjangoObjectType):
class PortfolioQuery(object):
project = graphene.Field(ProjectNode, id=graphene.ID(), slug=graphene.String())
projects = DjangoFilterConnectionField(ProjectNode)
projects = graphene.List(ProjectNode)
def resolve_projects(self, info, **kwargs):
user = info.context.user

View File

@ -461,7 +461,7 @@ type CustomQuery {
survey(id: ID): SurveyNode
surveys(offset: Int, before: String, after: String, first: Int, last: Int): SurveyNodeConnection
project(id: ID, slug: String): ProjectNode
projects(offset: Int, before: String, after: String, first: Int, last: Int, slug: String, appearance: String): ProjectNodeConnection
projects: [ProjectNode]
instrument(slug: String, id: ID): InstrumentNode
instruments(offset: Int, before: String, after: String, first: Int, last: Int, slug: String, type: String): InstrumentNodeConnection
studentSubmission(id: ID!): StudentSubmissionNode
@ -891,16 +891,6 @@ type ProjectNode implements Node {
entriesCount: Int
}
type ProjectNodeConnection {
pageInfo: PageInfo!
edges: [ProjectNodeEdge]!
}
type ProjectNodeEdge {
node: ProjectNode
cursor: String!
}
type PublicUserNode implements Node {
firstName: String!
lastName: String!