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

View File

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

View File

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

View File

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

View File

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