diff --git a/firestore.indexes.json b/firestore.indexes.json index 415027e5dd..4683ba2af9 100644 --- a/firestore.indexes.json +++ b/firestore.indexes.json @@ -1,4 +1,27 @@ { "indexes": [], - "fieldOverrides": [] + "fieldOverrides": [ + { + "collectionGroup": "members", + "fieldPath": "name", + "indexes": [ + { + "order": "ASCENDING", + "queryScope": "COLLECTION" + }, + { + "order": "DESCENDING", + "queryScope": "COLLECTION" + }, + { + "arrayConfig": "CONTAINS", + "queryScope": "COLLECTION" + }, + { + "order": "ASCENDING", + "queryScope": "COLLECTION_GROUP" + } + ] + } + ] } diff --git a/firestore.rules b/firestore.rules index ab127c71e9..fc2bc8187a 100644 --- a/firestore.rules +++ b/firestore.rules @@ -186,6 +186,7 @@ service cloud.firestore { // Disallow writes allow write: if false; + // TODO: remove match /members/{memberId} { // Applies to single document read requests allow get; @@ -198,6 +199,17 @@ service cloud.firestore { } } + match /{path=**}/members/{memberId} { + // Applies to single document read requests + allow get; + + // Applies to queries and collection read requests + allow list; + + // Disallow writes + allow write: if false; + } + match /tickets/{ticket} { // Applies to single document read requests allow get; diff --git a/src/models/member.ts b/src/models/member.ts index 7b5197cde9..8adca1b7dc 100644 --- a/src/models/member.ts +++ b/src/models/member.ts @@ -1,5 +1,5 @@ import { Social } from './social'; -import { Id } from './types'; +import { ParentId } from './types'; export interface MemberData { name: string; @@ -10,4 +10,4 @@ export interface MemberData { title: string; } -export type Member = Id & MemberData; +export type Member = ParentId & MemberData; diff --git a/src/models/types.ts b/src/models/types.ts index 62568f255e..66e5a8ad52 100644 --- a/src/models/types.ts +++ b/src/models/types.ts @@ -1,3 +1,7 @@ export interface Id { id: string; } + +export type ParentId = Id & { + parentId: string; +}; diff --git a/src/pages/team-page.ts b/src/pages/team-page.ts index 1fa54aecbf..70168fa4e8 100644 --- a/src/pages/team-page.ts +++ b/src/pages/team-page.ts @@ -1,4 +1,4 @@ -import { Failure, Initialized, Pending } from '@abraham/remotedata'; +import { Failure, Pending } from '@abraham/remotedata'; import { computed, customElement, property } from '@polymer/decorators'; import '@polymer/iron-icon'; import '@polymer/marked-element'; @@ -7,25 +7,12 @@ import { html, PolymerElement } from '@polymer/polymer'; import 'plastic-image'; import '../elements/shared-styles'; import { ReduxMixin } from '../mixins/redux-mixin'; -import { RootState, store } from '../store'; -import { fetchTeams } from '../store/teams/actions'; -import { initialTeamsState } from '../store/teams/state'; +import { RootState } from '../store'; +import { selectTeamsAndMembers } from '../store/teams-members/selectors'; +import { initialTeamsMembersState } from '../store/teams-members/state'; @customElement('team-page') export class TeamPage extends ReduxMixin(PolymerElement) { - @property({ type: Object }) - teams = initialTeamsState; - - @computed('teams') - get pending() { - return this.teams instanceof Pending; - } - - @computed('teams') - get failure() { - return this.teams instanceof Failure; - } - static get template() { return html`