Add entry count, start working on dynamic room color
This commit is contained in:
parent
eee12f5871
commit
087e8ce252
|
|
@ -19,7 +19,7 @@
|
||||||
import RoomEntryCountWidget from '@/components/rooms/RoomEntryCountWidget';
|
import RoomEntryCountWidget from '@/components/rooms/RoomEntryCountWidget';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['title', 'appearance', 'slug', 'userGroup'],
|
props: ['slug', 'title', 'entryCount', 'appearance', 'userGroup'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
RoomEntryCountWidget,
|
RoomEntryCountWidget,
|
||||||
|
|
@ -28,9 +28,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
entryCount() {
|
|
||||||
return 6 // TODO: this.entries.length
|
|
||||||
},
|
|
||||||
roomClass() {
|
roomClass() {
|
||||||
return `room-widget--${this.appearance}`
|
return `room-widget--${this.appearance}`
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@ query RoomEntriesQuery($slug: String!) {
|
||||||
slug
|
slug
|
||||||
appearance
|
appearance
|
||||||
pk
|
pk
|
||||||
|
userGroup {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
year
|
||||||
|
}
|
||||||
roomentrySet {
|
roomentrySet {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@ query RoomsQuery {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
title
|
|
||||||
appearance
|
|
||||||
slug
|
slug
|
||||||
|
title
|
||||||
|
entryCount
|
||||||
|
appearance
|
||||||
userGroup {
|
userGroup {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@ from graphene_django import DjangoObjectType
|
||||||
from graphene_django.filter import DjangoFilterConnectionField
|
from graphene_django.filter import DjangoFilterConnectionField
|
||||||
|
|
||||||
from rooms.models import Room, RoomEntry
|
from rooms.models import Room, RoomEntry
|
||||||
from user.schema import UserGroupNode, UserType
|
from user.schema import UserType
|
||||||
|
|
||||||
|
|
||||||
class RoomEntryType(DjangoObjectType):
|
class RoomEntryType(DjangoObjectType):
|
||||||
|
|
@ -22,7 +22,7 @@ class RoomEntryType(DjangoObjectType):
|
||||||
|
|
||||||
class RoomType(DjangoObjectType):
|
class RoomType(DjangoObjectType):
|
||||||
pk = graphene.Int()
|
pk = graphene.Int()
|
||||||
user_group = UserGroupNode()
|
entry_count = graphene.Int()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Room
|
model = Room
|
||||||
|
|
@ -32,6 +32,9 @@ class RoomType(DjangoObjectType):
|
||||||
def resolve_pk(self, *args, **kwargs):
|
def resolve_pk(self, *args, **kwargs):
|
||||||
return self.id
|
return self.id
|
||||||
|
|
||||||
|
def resolve_entry_count(self, *args, **kwargs):
|
||||||
|
return self.roomentry_set.count()
|
||||||
|
|
||||||
|
|
||||||
class RoomsQuery(object):
|
class RoomsQuery(object):
|
||||||
room = graphene.Field(RoomType, slug=graphene.String(), id=graphene.Int(), appearance=graphene.String())
|
room = graphene.Field(RoomType, slug=graphene.String(), id=graphene.Int(), appearance=graphene.String())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue