This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const routes: Routes = [ | |
/** | |
* When the path is '' it will know to redirect the user to the landing page. | |
* This is setting up the default route that the user will always land on at first. | |
*/ | |
{ path: '', redirectTo: '/landing', pathMatch: 'full' }, | |
{ | |
/** | |
* Landing will always be the first route we get to in order to bootstrap | |
* the virtual pages and make our lives a little easier in so far as routing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a simple function which returns | |
* a boolean value indicating if a given | |
* string is a palindrome. Punctuation should | |
* be ignored. | |
* | |
* palindrome: a word, phrase, or sequence | |
* that reads the same backward as forward, | |
* e.g., madam or nurses run. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /AdminStuff/{StuffId} { | |
allow read, write: if isAdmin(); | |
} | |
function isAdmin() { | |
return request.auth.token['isAdmin'] == true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /Users/{UserId} { | |
// Allow anyone to create an account | |
allow create: if true; | |
// UserId comes from {UserId} above | |
// the UserId will be auto-filled with the UserId | |
// of the user trying to access this record | |
allow read, update, delete: if isOwner(UserId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as express from 'express'; | |
import * as cors from 'cors'; | |
import * as bodyParser from 'body-parser'; | |
import * as sentry from '@sentry/node'; | |
import * as admin from 'firebase-admin'; | |
import { APIResponse } from '@sredmond/apiresponse'; | |
import * as functions from 'firebase-functions'; | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mat-card class="md-margin"> | |
<mat-toolbar [style.background]="'none'" *ngIf="note !== undefined"> | |
<span flex>{{ note.Title }}</span> | |
<button mat-icon-button color="warn" (click)="deleteNote()"> | |
<mat-icon>delete</mat-icon> | |
</button> | |
</mat-toolbar> | |
<div layout="column" *ngIf="noteForm.disabled" class="md-padding"> | |
<p>{{ note.Note }}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *ngIf="user | async as User"> | |
<button mat-raised-button color="accent" (click)="newNote = true"> | |
Create Note | |
</button> | |
<h2 *ngIf="User.NumNotes === 0">Looks like there are no notes to display</h2> | |
<h2 *ngIf="User.NumNotes > 0">You have {{ User.NumNotes }} notes</h2> | |
<app-note *ngIf="newNote" (update)="createNote($event, User.Id)"></app-note> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as functions from "firebase-functions"; | |
import * as admin from "firebase-admin"; | |
import { INote, IUser, NoteModel } from "firebasenoteapptypes"; | |
import { AlgoliaSearch } from "../algolia"; | |
const index = new AlgoliaSearch("Notes"); | |
export const NoteCreated = functions.firestore | |
.document("Notes/{NoteId}") | |
.onCreate(async (snapshot, context) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as algoliasearch from "algoliasearch"; | |
import * as functions from "firebase-functions"; | |
import { Model } from "firebasenoteapptypes"; | |
const algolia = algoliasearch( | |
functions.config().algolia.appid, | |
functions.config().algolia.adminkey | |
); | |
type IndexName = "Notes" | "Users" | "Notifications"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IModel { | |
Id: string; | |
CreatedOn: number; | |
} | |
export interface IAlgoliaModel { | |
objectID: string; | |
_tags?: string[]; | |
} |