Merge branch 'hotfix/remove-private-user-node' into develop

This commit is contained in:
Ramon Wenger 2024-03-28 15:41:10 +01:00
commit 5dca389003
4 changed files with 272 additions and 270 deletions

View File

@ -262,7 +262,7 @@ export type AnswerNode = Node & {
data: Scalars['JSONString']['output']; data: Scalars['JSONString']['output'];
/** The ID of the object */ /** The ID of the object */
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
owner: PrivateUserNode; owner: PublicUserNode;
pk?: Maybe<Scalars['Int']['output']>; pk?: Maybe<Scalars['Int']['output']>;
survey: SurveyNode; survey: SurveyNode;
}; };
@ -313,7 +313,7 @@ export type AssignmentNode = Node & {
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
modified: Scalars['DateTime']['output']; modified: Scalars['DateTime']['output'];
module: ModuleNode; module: ModuleNode;
owner?: Maybe<PrivateUserNode>; owner?: Maybe<PublicUserNode>;
path: Scalars['String']['output']; path: Scalars['String']['output'];
solution?: Maybe<Scalars['String']['output']>; solution?: Maybe<Scalars['String']['output']>;
submission?: Maybe<StudentSubmissionNode>; submission?: Maybe<StudentSubmissionNode>;
@ -349,7 +349,7 @@ export type ChapterBookmarkNode = Node & {
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
note?: Maybe<NoteNode>; note?: Maybe<NoteNode>;
path?: Maybe<Scalars['String']['output']>; path?: Maybe<Scalars['String']['output']>;
user: PrivateUserNode; user: PublicUserNode;
}; };
export type ChapterBookmarkNodeConnection = { export type ChapterBookmarkNodeConnection = {
@ -439,7 +439,7 @@ export type ContentBlockBookmarkNode = Node & {
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
note?: Maybe<NoteNode>; note?: Maybe<NoteNode>;
path?: Maybe<Scalars['String']['output']>; path?: Maybe<Scalars['String']['output']>;
user: PrivateUserNode; user: PublicUserNode;
uuid?: Maybe<Scalars['UUID']['output']>; uuid?: Maybe<Scalars['UUID']['output']>;
}; };
@ -770,7 +770,7 @@ export type HighlightNode = Node & {
selectionLength: Scalars['Int']['output']; selectionLength: Scalars['Int']['output'];
startPosition: Scalars['Int']['output']; startPosition: Scalars['Int']['output'];
text: Scalars['String']['output']; text: Scalars['String']['output'];
user: PrivateUserNode; user: PublicUserNode;
}; };
export type HighlightableNode = ChapterNode | ContentBlockNode | InstrumentNode | ModuleNode; export type HighlightableNode = ChapterNode | ContentBlockNode | InstrumentNode | ModuleNode;
@ -796,7 +796,7 @@ export type InstrumentBookmarkNode = Node & {
instrument: InstrumentNode; instrument: InstrumentNode;
note?: Maybe<NoteNode>; note?: Maybe<NoteNode>;
path: Scalars['String']['output']; path: Scalars['String']['output'];
user: PrivateUserNode; user: PublicUserNode;
uuid?: Maybe<Scalars['UUID']['output']>; uuid?: Maybe<Scalars['UUID']['output']>;
}; };
@ -899,7 +899,7 @@ export type ModuleBookmarkNode = {
module: ModuleNode; module: ModuleNode;
note?: Maybe<NoteNode>; note?: Maybe<NoteNode>;
path?: Maybe<Scalars['String']['output']>; path?: Maybe<Scalars['String']['output']>;
user: PrivateUserNode; user: PublicUserNode;
}; };
export type ModuleCategoryNode = Node & { export type ModuleCategoryNode = Node & {
@ -1519,7 +1519,7 @@ export type ObjectiveNode = Node & {
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
mine?: Maybe<Scalars['Boolean']['output']>; mine?: Maybe<Scalars['Boolean']['output']>;
order?: Maybe<Scalars['Int']['output']>; order?: Maybe<Scalars['Int']['output']>;
owner?: Maybe<PrivateUserNode>; owner?: Maybe<PublicUserNode>;
pk?: Maybe<Scalars['Int']['output']>; pk?: Maybe<Scalars['Int']['output']>;
text: Scalars['String']['output']; text: Scalars['String']['output'];
userCreated?: Maybe<Scalars['Boolean']['output']>; userCreated?: Maybe<Scalars['Boolean']['output']>;
@ -1655,11 +1655,10 @@ export type ProjectNode = Node & {
/** The ID of the object */ /** The ID of the object */
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
objectives: Scalars['String']['output']; objectives: Scalars['String']['output'];
owner?: Maybe<PublicUserNode>;
pk?: Maybe<Scalars['Int']['output']>; pk?: Maybe<Scalars['Int']['output']>;
schoolClass?: Maybe<SchoolClassNode>; schoolClass?: Maybe<SchoolClassNode>;
slug: Scalars['String']['output']; slug: Scalars['String']['output'];
student: PrivateUserNode; student?: Maybe<PublicUserNode>;
title: Scalars['String']['output']; title: Scalars['String']['output'];
}; };
@ -2125,7 +2124,7 @@ export type StudentSubmissionNode = Node & {
/** The ID of the object */ /** The ID of the object */
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
modified: Scalars['DateTime']['output']; modified: Scalars['DateTime']['output'];
student: PrivateUserNode; student: PublicUserNode;
submissionFeedback?: Maybe<SubmissionFeedbackNode>; submissionFeedback?: Maybe<SubmissionFeedbackNode>;
text: Scalars['String']['output']; text: Scalars['String']['output'];
}; };
@ -2145,7 +2144,7 @@ export type SubmissionFeedbackNode = Node & {
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
modified: Scalars['DateTime']['output']; modified: Scalars['DateTime']['output'];
studentSubmission: StudentSubmissionNode; studentSubmission: StudentSubmissionNode;
teacher: PrivateUserNode; teacher: PublicUserNode;
text: Scalars['String']['output']; text: Scalars['String']['output'];
}; };
@ -2213,7 +2212,7 @@ export type SyncModuleVisibilityPayload = {
export type TeamNode = Node & { export type TeamNode = Node & {
__typename?: 'TeamNode'; __typename?: 'TeamNode';
code?: Maybe<Scalars['String']['output']>; code?: Maybe<Scalars['String']['output']>;
creator?: Maybe<PrivateUserNode>; creator: PublicUserNode;
/** The ID of the object */ /** The ID of the object */
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
isDeleted: Scalars['Boolean']['output']; isDeleted: Scalars['Boolean']['output'];
@ -2695,7 +2694,7 @@ export type ReadOnlyQueryQueryVariables = Exact<{ [key: string]: never; }>;
export type ReadOnlyQueryQuery = { __typename?: 'Query', me?: { __typename?: 'PrivateUserNode', readOnly?: boolean | null, selectedClass?: { __typename?: 'SchoolClassNode', readOnly?: boolean | null } | null } | null }; export type ReadOnlyQueryQuery = { __typename?: 'Query', me?: { __typename?: 'PrivateUserNode', readOnly?: boolean | null, selectedClass?: { __typename?: 'SchoolClassNode', readOnly?: boolean | null } | null } | null };
export type SubmissionPartsFragment = { __typename?: 'StudentSubmissionNode', id: string, text: string, final: boolean, document: string, submissionFeedback?: { __typename?: 'SubmissionFeedbackNode', id: string, text: string, teacher: { __typename?: 'PrivateUserNode', firstName: string, lastName: string } } | null } & { ' $fragmentName'?: 'SubmissionPartsFragment' }; export type SubmissionPartsFragment = { __typename?: 'StudentSubmissionNode', id: string, text: string, final: boolean, document: string, submissionFeedback?: { __typename?: 'SubmissionFeedbackNode', id: string, text: string, teacher: { __typename?: 'PublicUserNode', firstName: string, lastName: string } } | null } & { ' $fragmentName'?: 'SubmissionPartsFragment' };
export type AssignmentPartsFragment = { __typename?: 'AssignmentNode', id: string, title: string, assignment: string, solution?: string | null, submission?: ( export type AssignmentPartsFragment = { __typename?: 'AssignmentNode', id: string, title: string, assignment: string, solution?: string | null, submission?: (
{ __typename?: 'StudentSubmissionNode' } { __typename?: 'StudentSubmissionNode' }

View File

@ -5,7 +5,7 @@ from graphene_django import DjangoObjectType
from api.utils import get_by_id_or_slug from api.utils import get_by_id_or_slug
from portfolio.models import Project, ProjectEntry from portfolio.models import Project, ProjectEntry
from users.models import Role, UserRole, User from users.models import Role, UserRole
from users.schema import PublicUserNode from users.schema import PublicUserNode
@ -13,18 +13,18 @@ class ProjectEntryNode(DjangoObjectType):
class Meta: class Meta:
model = ProjectEntry model = ProjectEntry
interfaces = (relay.Node,) interfaces = (relay.Node,)
fields = ('description', 'document_url', 'project', 'created') fields = ("description", "document_url", "project", "created")
class ProjectNode(DjangoObjectType): class ProjectNode(DjangoObjectType):
pk = graphene.Int() pk = graphene.Int()
entries_count = graphene.Int() entries_count = graphene.Int()
entries = graphene.List(ProjectEntryNode) entries = graphene.List(ProjectEntryNode)
owner = graphene.Field(PublicUserNode) student = graphene.Field(PublicUserNode)
class Meta: class Meta:
model = Project model = Project
filter_fields = ['slug', 'appearance'] filter_fields = ["slug", "appearance"]
interfaces = (relay.Node,) interfaces = (relay.Node,)
def resolve_pk(self, *args, **kwargs): def resolve_pk(self, *args, **kwargs):
@ -45,11 +45,16 @@ class PortfolioQuery(object):
def resolve_projects(self, info, **kwargs): def resolve_projects(self, info, **kwargs):
user = info.context.user user = info.context.user
if user.is_superuser: if user.is_superuser:
return Project.objects.all().order_by('-pk') return Project.objects.all().order_by("-pk")
if UserRole.get_role_for_user(user).role == Role.objects.get_default_teacher_role(): if (
return Project.objects.filter(Q(student__school_classes__in=user.school_classes.all(), final=True) | UserRole.get_role_for_user(user).role
Q(student=user, final=False)).distinct() == Role.objects.get_default_teacher_role()
):
return Project.objects.filter(
Q(student__school_classes__in=user.school_classes.all(), final=True)
| Q(student=user, final=False)
).distinct()
return Project.objects.filter(student=user) return Project.objects.filter(student=user)

View File

@ -170,7 +170,7 @@ type TopicNode implements Node {
type HighlightNode implements Node { type HighlightNode implements Node {
"""The ID of the object""" """The ID of the object"""
id: ID! id: ID!
user: PrivateUserNode! user: PublicUserNode!
page: HighlightableNode! page: HighlightableNode!
contentIndex: Int contentIndex: Int
contentUuid: UUID contentUuid: UUID
@ -182,45 +182,195 @@ type HighlightNode implements Node {
color: String! color: String!
} }
type PrivateUserNode implements Node { type PublicUserNode implements Node {
firstName: String! firstName: String!
lastName: String! lastName: String!
avatarUrl: String! avatarUrl: String!
"""The ID of the object"""
id: ID!
fullName: String!
isMe: Boolean
}
union HighlightableNode = ContentBlockNode | InstrumentNode | ModuleNode | ChapterNode
type ContentBlockNode implements Node & ContentBlockInterface {
title: String
""" """
Erforderlich. 150 Zeichen oder weniger. Nur Buchstaben, Ziffern und @/./+/-/_. Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/
""" """
username: String! slug: String!
lastModule: ModuleNode hiddenFor: [SchoolClassNode]
lastModuleLevel: ModuleLevelNode visibleFor: [SchoolClassNode]
lastTopic: TopicNode userCreated: Boolean!
email: String! contents: GenericStreamFieldType
onboardingVisited: Boolean! type: String!
team: TeamNode
schoolClasses: [SchoolClassNode] """The ID of the object"""
id: ID!
mine: Boolean
bookmarks: [ContentBlockBookmarkNode]
originalCreator: PublicUserNode
instrumentCategory: InstrumentCategoryNode
path: String
highlights: [HighlightNode]
}
interface ContentBlockInterface {
title: String
contents: GenericStreamFieldType
type: String!
}
scalar GenericStreamFieldType
type SchoolClassNode implements Node {
name: String!
code: String
"""The ID of the object""" """The ID of the object"""
id: ID! id: ID!
pk: Int pk: Int
permissions: [String] members: [ClassMemberNode]
selectedClass: SchoolClassNode
expiryDate: String
isTeacher: Boolean
oldClasses: [SchoolClassNode]
recentModules(
offset: Int
before: String
after: String
first: Int
last: Int
recentModules: ID
"""Sortierung"""
orderBy: String
): ModuleNodeConnection
readOnly: Boolean readOnly: Boolean
} }
"""
We need to build this ourselves, because we want the active property on the node, because providing it on the
Connection or Edge for a UserNodeConnection is difficult.
"""
type ClassMemberNode {
user: PublicUserNode
active: Boolean
firstName: String
lastName: String
isTeacher: Boolean
id: ID
isMe: Boolean
}
type ContentBlockBookmarkNode implements Node {
"""The ID of the object"""
id: ID!
user: PublicUserNode!
note: NoteNode
uuid: UUID
contentBlock: ContentBlockNode!
path: String
content: String
}
type NoteNode implements Node {
"""The ID of the object"""
id: ID!
text: String!
contentblockbookmark: ContentBlockBookmarkNode
modulebookmark: ModuleBookmarkNode
chapterbookmark: ChapterBookmarkNode
instrumentbookmark: InstrumentBookmarkNode
highlight: HighlightNode
pk: Int
}
type ModuleBookmarkNode {
id: ID!
user: PublicUserNode!
note: NoteNode
module: ModuleNode!
path: String
content: String
}
type ChapterBookmarkNode implements Node {
"""The ID of the object"""
id: ID!
user: PublicUserNode!
note: NoteNode
chapter: ChapterNode!
path: String
content: String
}
type ChapterNode implements Node & ChapterInterface {
title: String
"""
Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/
"""
slug: String!
description: String
titleHiddenFor: [SchoolClassNode]
descriptionHiddenFor: [SchoolClassNode]
"""The ID of the object"""
id: ID!
bookmark: ChapterBookmarkNode
contentBlocks: [ContentBlockNode]
path: String
highlights: [HighlightNode]
}
interface ChapterInterface {
description: String
title: String
}
type InstrumentBookmarkNode implements Node {
"""The ID of the object"""
id: ID!
user: PublicUserNode!
note: NoteNode
uuid: UUID
instrument: InstrumentNode!
path: String!
content: String
}
"""
Leverages the internal Python implementation of UUID (uuid.UUID) to provide native UUID objects
in fields, resolvers and input.
"""
scalar UUID
type InstrumentNode implements Node {
"""Der Seitentitel, der öffentlich angezeigt werden soll"""
title: String!
"""
Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/
"""
slug: String!
intro: String!
contents: GenericStreamFieldType
"""The ID of the object"""
id: ID!
bookmarks: [InstrumentBookmarkNode]
type: InstrumentTypeNode
language: String
highlights: [HighlightNode!]!
path: String!
}
type InstrumentTypeNode implements Node {
"""The ID of the object"""
id: ID!
name: String!
category: InstrumentCategoryNode
type: String!
}
type InstrumentCategoryNode implements Node {
"""The ID of the object"""
id: ID!
name: String!
background: String!
foreground: String!
types: [InstrumentTypeNode]
}
type ModuleLevelNode implements Node { type ModuleLevelNode implements Node {
"""The ID of the object""" """The ID of the object"""
id: ID! id: ID!
@ -275,206 +425,6 @@ type ModuleNodeEdge {
cursor: String! cursor: String!
} }
type TeamNode implements Node {
"""The ID of the object"""
id: ID!
name: String!
isDeleted: Boolean!
code: String
creator: PrivateUserNode
members: [PublicUserNode]
pk: Int
}
type PublicUserNode implements Node {
firstName: String!
lastName: String!
avatarUrl: String!
"""The ID of the object"""
id: ID!
fullName: String!
isMe: Boolean
}
type SchoolClassNode implements Node {
name: String!
code: String
"""The ID of the object"""
id: ID!
pk: Int
members: [ClassMemberNode]
readOnly: Boolean
}
"""
We need to build this ourselves, because we want the active property on the node, because providing it on the
Connection or Edge for a UserNodeConnection is difficult.
"""
type ClassMemberNode {
user: PublicUserNode
active: Boolean
firstName: String
lastName: String
isTeacher: Boolean
id: ID
isMe: Boolean
}
union HighlightableNode = ContentBlockNode | InstrumentNode | ModuleNode | ChapterNode
type ContentBlockNode implements Node & ContentBlockInterface {
title: String
"""
Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/
"""
slug: String!
hiddenFor: [SchoolClassNode]
visibleFor: [SchoolClassNode]
userCreated: Boolean!
contents: GenericStreamFieldType
type: String!
"""The ID of the object"""
id: ID!
mine: Boolean
bookmarks: [ContentBlockBookmarkNode]
originalCreator: PublicUserNode
instrumentCategory: InstrumentCategoryNode
path: String
highlights: [HighlightNode]
}
interface ContentBlockInterface {
title: String
contents: GenericStreamFieldType
type: String!
}
scalar GenericStreamFieldType
type ContentBlockBookmarkNode implements Node {
"""The ID of the object"""
id: ID!
user: PrivateUserNode!
note: NoteNode
uuid: UUID
contentBlock: ContentBlockNode!
path: String
content: String
}
type NoteNode implements Node {
"""The ID of the object"""
id: ID!
text: String!
contentblockbookmark: ContentBlockBookmarkNode
modulebookmark: ModuleBookmarkNode
chapterbookmark: ChapterBookmarkNode
instrumentbookmark: InstrumentBookmarkNode
highlight: HighlightNode
pk: Int
}
type ModuleBookmarkNode {
id: ID!
user: PrivateUserNode!
note: NoteNode
module: ModuleNode!
path: String
content: String
}
type ChapterBookmarkNode implements Node {
"""The ID of the object"""
id: ID!
user: PrivateUserNode!
note: NoteNode
chapter: ChapterNode!
path: String
content: String
}
type ChapterNode implements Node & ChapterInterface {
title: String
"""
Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/
"""
slug: String!
description: String
titleHiddenFor: [SchoolClassNode]
descriptionHiddenFor: [SchoolClassNode]
"""The ID of the object"""
id: ID!
bookmark: ChapterBookmarkNode
contentBlocks: [ContentBlockNode]
path: String
highlights: [HighlightNode]
}
interface ChapterInterface {
description: String
title: String
}
type InstrumentBookmarkNode implements Node {
"""The ID of the object"""
id: ID!
user: PrivateUserNode!
note: NoteNode
uuid: UUID
instrument: InstrumentNode!
path: String!
content: String
}
"""
Leverages the internal Python implementation of UUID (uuid.UUID) to provide native UUID objects
in fields, resolvers and input.
"""
scalar UUID
type InstrumentNode implements Node {
"""Der Seitentitel, der öffentlich angezeigt werden soll"""
title: String!
"""
Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/
"""
slug: String!
intro: String!
contents: GenericStreamFieldType
"""The ID of the object"""
id: ID!
bookmarks: [InstrumentBookmarkNode]
type: InstrumentTypeNode
language: String
highlights: [HighlightNode!]!
path: String!
}
type InstrumentTypeNode implements Node {
"""The ID of the object"""
id: ID!
name: String!
category: InstrumentCategoryNode
type: String!
}
type InstrumentCategoryNode implements Node {
"""The ID of the object"""
id: ID!
name: String!
background: String!
foreground: String!
types: [InstrumentTypeNode]
}
type ModuleCategoryNode implements Node { type ModuleCategoryNode implements Node {
"""The ID of the object""" """The ID of the object"""
id: ID! id: ID!
@ -504,7 +454,7 @@ type AssignmentNode implements Node {
assignment: String! assignment: String!
solution: String solution: String
deleted: Boolean! deleted: Boolean!
owner: PrivateUserNode owner: PublicUserNode
module: ModuleNode! module: ModuleNode!
userCreated: Boolean! userCreated: Boolean!
taskbaseId: String taskbaseId: String
@ -528,7 +478,7 @@ type StudentSubmissionNode implements Node {
text: String! text: String!
document: String! document: String!
assignment: AssignmentNode! assignment: AssignmentNode!
student: PrivateUserNode! student: PublicUserNode!
final: Boolean! final: Boolean!
submissionFeedback: SubmissionFeedbackNode submissionFeedback: SubmissionFeedbackNode
} }
@ -537,7 +487,7 @@ type SubmissionFeedbackNode implements Node {
created: DateTime! created: DateTime!
modified: DateTime! modified: DateTime!
text: String! text: String!
teacher: PrivateUserNode! teacher: PublicUserNode!
studentSubmission: StudentSubmissionNode! studentSubmission: StudentSubmissionNode!
final: Boolean! final: Boolean!
@ -573,7 +523,7 @@ type ObjectiveNode implements Node {
id: ID! id: ID!
text: String! text: String!
group: ObjectiveGroupNode! group: ObjectiveGroupNode!
owner: PrivateUserNode owner: PublicUserNode
hiddenFor: [SchoolClassNode] hiddenFor: [SchoolClassNode]
visibleFor: [SchoolClassNode] visibleFor: [SchoolClassNode]
order: Int order: Int
@ -697,7 +647,7 @@ type SnapshotChangesNode {
type AnswerNode implements Node { type AnswerNode implements Node {
"""The ID of the object""" """The ID of the object"""
id: ID! id: ID!
owner: PrivateUserNode! owner: PublicUserNode!
data: JSONString! data: JSONString!
survey: SurveyNode! survey: SurveyNode!
pk: Int pk: Int
@ -789,13 +739,12 @@ type ProjectNode implements Node {
slug: String! slug: String!
objectives: String! objectives: String!
appearance: String! appearance: String!
student: PrivateUserNode! student: PublicUserNode
final: Boolean! final: Boolean!
schoolClass: SchoolClassNode schoolClass: SchoolClassNode
entries: [ProjectEntryNode] entries: [ProjectEntryNode]
pk: Int pk: Int
entriesCount: Int entriesCount: Int
owner: PublicUserNode
} }
type ProjectEntryNode implements Node { type ProjectEntryNode implements Node {
@ -940,6 +889,55 @@ type CommentNode implements Node {
id: ID! id: ID!
} }
type PrivateUserNode implements Node {
"""
Erforderlich. 150 Zeichen oder weniger. Nur Buchstaben, Ziffern und @/./+/-/_.
"""
username: String!
firstName: String!
lastName: String!
lastModule: ModuleNode
lastModuleLevel: ModuleLevelNode
lastTopic: TopicNode
avatarUrl: String!
email: String!
onboardingVisited: Boolean!
team: TeamNode
schoolClasses: [SchoolClassNode]
"""The ID of the object"""
id: ID!
pk: Int
permissions: [String]
selectedClass: SchoolClassNode
expiryDate: String
isTeacher: Boolean
oldClasses: [SchoolClassNode]
recentModules(
offset: Int
before: String
after: String
first: Int
last: Int
recentModules: ID
"""Sortierung"""
orderBy: String
): ModuleNodeConnection
readOnly: Boolean
}
type TeamNode implements Node {
"""The ID of the object"""
id: ID!
name: String!
isDeleted: Boolean!
code: String
creator: PublicUserNode
members: [PublicUserNode]
pk: Int
}
type PrivateUserNodeConnection { type PrivateUserNodeConnection {
"""Pagination data for this connection.""" """Pagination data for this connection."""
pageInfo: PageInfo! pageInfo: PageInfo!

View File

@ -70,20 +70,6 @@ class TeamNode(DjangoObjectType):
return self.members.all() return self.members.all()
class PublicUserNode(DjangoObjectType):
full_name = graphene.String(required=True)
is_me = graphene.Boolean()
class Meta:
model = User
only_fields = ["full_name", "first_name", "last_name", "avatar_url"]
interfaces = (relay.Node,)
@staticmethod
def resolve_is_me(parent: User, info, **kwargs):
return info.context.user.pk == parent.pk
class PrivateUserNode(DjangoObjectType): class PrivateUserNode(DjangoObjectType):
class Meta: class Meta:
model = User model = User
@ -168,6 +154,20 @@ class PrivateUserNode(DjangoObjectType):
return self.team return self.team
class PublicUserNode(DjangoObjectType):
full_name = graphene.String(required=True)
is_me = graphene.Boolean()
class Meta:
model = User
only_fields = ["full_name", "first_name", "last_name", "avatar_url"]
interfaces = (relay.Node,)
@staticmethod
def resolve_is_me(parent: User, info, **kwargs):
return info.context.user.pk == parent.pk
class ClassMemberNode(ObjectType): class ClassMemberNode(ObjectType):
""" """
We need to build this ourselves, because we want the active property on the node, because providing it on the We need to build this ourselves, because we want the active property on the node, because providing it on the