Skip to content

Instantly share code, notes, and snippets.

View felipepastorelima's full-sized avatar

Felipe Lima felipepastorelima

View GitHub Profile
@felipepastorelima
felipepastorelima / localhostFileStorage.ts
Created June 23, 2021 19:11
backend/src/services/file/localhostFileStorage.ts
import path from 'path';
import fs from 'fs';
import os from 'os';
import jwt from 'jsonwebtoken';
import { getConfig } from '../../config';
import mv from 'mv';
import Error403 from '../../errors/Error403';
/**
* The directory where the files should be uploaded.
@felipepastorelima
felipepastorelima / firestore.rules
Last active September 30, 2021 15:11
Firestore Rules utilities to reduce verbosity. Generator: https://scaffoldhub.io/firestore-rules
service cloud.firestore {
match /databases/{database}/documents {
// START - Usage example
match /people/{document=**} {
function propertiesValid() {
return request.resource.data.keys().hasAll(['name', 'birthdate', 'yearsOfExperience'])
&& request.resource.data.size() == 3
&& isString('name') && minlength('name', 3) && maxlength('name', 255)