Little tweaks to make it work... In a devcontainer anyway....
@@ -1,13 +1,21 @@
|
||||
FROM node:18-bullseye
|
||||
FROM node:14-bullseye
|
||||
|
||||
# Install additional tools including Ionic CLI
|
||||
# Install additional tools including Ionic CLI and build dependencies for older projects
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
vim \
|
||||
mongodb-clients \
|
||||
python2.7 \
|
||||
python2.7-dev \
|
||||
build-essential \
|
||||
&& ln -sf /usr/bin/python2.7 /usr/bin/python \
|
||||
&& ln -sf /usr/bin/python2.7 /usr/bin/python2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install MongoDB shell via npm (works on all architectures)
|
||||
# Note: mongosh requires Node 18+, but we're using Node 14 for legacy compatibility
|
||||
# We'll use the mongo command from the mongo container instead
|
||||
|
||||
# Install global npm packages for development
|
||||
RUN npm install -g \
|
||||
@ionic/cli \
|
||||
@@ -18,17 +26,18 @@ RUN npm install -g \
|
||||
prettier
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /workspaces/PfosiLooking
|
||||
WORKDIR /workspaces/PfosiLooking-monorepo
|
||||
|
||||
# Copy package files for dependency caching
|
||||
COPY package*.json ./
|
||||
COPY app/package*.json ./app/
|
||||
COPY backend/package*.json ./backend/
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
RUN cd app && npm install
|
||||
RUN cd backend && npm install
|
||||
# Install dependencies separately to avoid node-sass issues during build
|
||||
# We'll install them after container starts
|
||||
# RUN npm install
|
||||
# RUN cd app && npm install
|
||||
# RUN cd backend && npm install
|
||||
|
||||
# Keep container running
|
||||
CMD ["sleep", "infinity"]
|
||||
@@ -2,11 +2,11 @@
|
||||
"name": "PfosiLooking Full Stack",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspaces/PfosiLooking",
|
||||
"workspaceFolder": "/workspaces/PfosiLooking-monorepo",
|
||||
"shutdownAction": "stopCompose",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
"version": "18"
|
||||
"version": "14"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/git:1": {},
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
@@ -28,7 +28,7 @@
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
"emmet.includeLanguages": {
|
||||
"javascript": "javascriptreact"
|
||||
@@ -55,6 +55,6 @@
|
||||
"onAutoForward": "notify"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "npm install && cd app && npm install && cd ../backend && npm install",
|
||||
"postStartCommand": "npm run dev:all"
|
||||
"postCreateCommand": ".devcontainer/postCreateCommand.sh",
|
||||
"postStartCommand": "echo 'DevContainer ready! Run npm run dev:all to start development.'"
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ services:
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
- /workspaces/PfosiLooking/app/node_modules
|
||||
- /workspaces/PfosiLooking/backend/node_modules
|
||||
- /workspaces/PfosiLooking-monorepo/app/node_modules
|
||||
- /workspaces/PfosiLooking-monorepo/backend/node_modules
|
||||
command: sleep infinity
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
|
||||
31
.devcontainer/postCreateCommand.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Setting up PfosiLooking monorepo dependencies..."
|
||||
echo "Using Node version: $(node --version)"
|
||||
|
||||
# Install root dependencies first
|
||||
echo "Installing root dependencies..."
|
||||
npm install
|
||||
|
||||
echo "Installing backend dependencies..."
|
||||
cd backend && npm install
|
||||
cd ..
|
||||
|
||||
echo "Installing app dependencies (Ionic 3 with legacy packages)..."
|
||||
cd app
|
||||
|
||||
# For Node 14 and older Ionic 3 projects, we need special handling
|
||||
echo "Installing with legacy peer dependencies support..."
|
||||
if npm install --legacy-peer-deps; then
|
||||
echo "App dependencies installed successfully!"
|
||||
else
|
||||
echo "Standard install failed, trying alternative approach..."
|
||||
# Try with force flag as last resort for very old packages
|
||||
npm install --legacy-peer-deps --force
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "All dependencies installed successfully!"
|
||||
echo "You can now start development with: npm run dev:all"
|
||||
132
.drone.yml
@@ -1,132 +0,0 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: looking-fullstack
|
||||
|
||||
steps:
|
||||
# Install dependencies for both apps
|
||||
- name: install-root
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- npm ci
|
||||
|
||||
- name: install-frontend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd app && npm ci
|
||||
depends_on:
|
||||
- install-root
|
||||
|
||||
- name: install-backend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd backend && npm ci
|
||||
depends_on:
|
||||
- install-root
|
||||
|
||||
# Linting
|
||||
- name: lint-frontend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd app && npm run lint
|
||||
depends_on:
|
||||
- install-frontend
|
||||
|
||||
- name: lint-backend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd backend && npm run lint
|
||||
depends_on:
|
||||
- install-backend
|
||||
|
||||
# Testing
|
||||
- name: test-frontend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd app && npm run test:ci
|
||||
depends_on:
|
||||
- install-frontend
|
||||
|
||||
- name: test-backend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd backend && npm test
|
||||
depends_on:
|
||||
- install-backend
|
||||
|
||||
# Build
|
||||
- name: build-frontend
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- cd app && npm run build
|
||||
depends_on:
|
||||
- lint-frontend
|
||||
- test-frontend
|
||||
|
||||
# Docker builds
|
||||
- name: docker-build-frontend
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: git.mifi.dev:12023
|
||||
repo: git.mifi.dev:12023/mifi/pfosi-looking-frontend
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_COMMIT_SHA:0:8}
|
||||
dockerfile: app/Dockerfile
|
||||
context: app
|
||||
depends_on:
|
||||
- build-frontend
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
- main
|
||||
|
||||
- name: docker-build-backend
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: git.mifi.dev:12023
|
||||
repo: git.mifi.dev:12023/mifi/pfosi-looking-backend
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_COMMIT_SHA:0:8}
|
||||
dockerfile: backend/Dockerfile
|
||||
context: backend
|
||||
depends_on:
|
||||
- lint-backend
|
||||
- test-backend
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
- main
|
||||
|
||||
# Deploy both services
|
||||
- name: deploy-stack
|
||||
image: curlimages/curl
|
||||
commands:
|
||||
- curl -X POST $PORTAINER_WEBHOOK_URL
|
||||
environment:
|
||||
PORTAINER_WEBHOOK_URL:
|
||||
from_secret: portainer_webhook_fullstack
|
||||
depends_on:
|
||||
- docker-build-frontend
|
||||
- docker-build-backend
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
- main
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- main
|
||||
- develop
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
7172
app/package-lock.json
generated
Normal file
@@ -33,7 +33,7 @@
|
||||
"zone.js": "0.8.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ionic/app-scripts": "3.1.8",
|
||||
"@ionic/app-scripts": "3.2.4",
|
||||
"typescript": "2.4.2"
|
||||
},
|
||||
"description": "Nick Pfosi's exploration at modern gay app-based meeting and dating"
|
||||
|
||||
|
Before Width: | Height: | Size: 616 KiB After Width: | Height: | Size: 616 KiB |
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 370 KiB After Width: | Height: | Size: 370 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 381 KiB After Width: | Height: | Size: 381 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 469 KiB After Width: | Height: | Size: 469 KiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 748 KiB After Width: | Height: | Size: 748 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 600 KiB After Width: | Height: | Size: 600 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 816 KiB After Width: | Height: | Size: 816 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 746 KiB After Width: | Height: | Size: 746 KiB |
|
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 445 KiB After Width: | Height: | Size: 445 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 424 KiB After Width: | Height: | Size: 424 KiB |
|
Before Width: | Height: | Size: 427 KiB After Width: | Height: | Size: 427 KiB |
|
Before Width: | Height: | Size: 466 KiB After Width: | Height: | Size: 466 KiB |
|
Before Width: | Height: | Size: 372 KiB After Width: | Height: | Size: 372 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 406 KiB After Width: | Height: | Size: 406 KiB |
|
Before Width: | Height: | Size: 624 KiB After Width: | Height: | Size: 624 KiB |
|
Before Width: | Height: | Size: 573 KiB After Width: | Height: | Size: 573 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
@@ -5,21 +5,35 @@
|
||||
<ion-icon name="arrow-back"></ion-icon>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
<ion-title><img class="title-profile-avatar" [src]="'https://appsby.fitz.guru/urge/' + this.profile.details.pic.thumb" height="24" width="24"> {{this.profile.details.name}}</ion-title>
|
||||
<ion-title
|
||||
><img
|
||||
class="title-profile-avatar"
|
||||
[src]="'/assets/' + this.profile.details.pic.thumb"
|
||||
height="24"
|
||||
width="24"
|
||||
/>
|
||||
{{this.profile.details.name}}</ion-title
|
||||
>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<ion-item class="message-bubble" *ngFor="let message of this.profile.messages" [ngClass]="{ 'is-user': (message.isUser == true) }">
|
||||
<img *ngIf="message.image" [src]="'https://appsby.fitz.guru/urge/' + message.image" (press)="showLightbox($event, message.image)">
|
||||
<ion-item
|
||||
class="message-bubble"
|
||||
*ngFor="let message of this.profile.messages"
|
||||
[ngClass]="{ 'is-user': (message.isUser == true) }"
|
||||
>
|
||||
<img
|
||||
*ngIf="message.image"
|
||||
[src]="'/assets/' + message.image"
|
||||
(press)="showLightbox($event, message.image)"
|
||||
/>
|
||||
<p *ngIf="message.text != ''">{{message.text}}</p>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
||||
<ion-footer>
|
||||
<ion-toolbar>
|
||||
|
||||
</ion-toolbar>
|
||||
<ion-toolbar> </ion-toolbar>
|
||||
</ion-footer>
|
||||
|
||||
@@ -1,45 +1,50 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { NavController } from 'ionic-angular';
|
||||
import { Component } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { NavController } from "ionic-angular";
|
||||
|
||||
import { ChatPage } from '../chat/chat';
|
||||
import { ProfileService } from '../../services/profiles';
|
||||
import { ProfilePage } from '../profile/profile';
|
||||
import { ChatPage } from "../chat/chat";
|
||||
import { ProfileService } from "../../services/profiles";
|
||||
import { ProfilePage } from "../profile/profile";
|
||||
|
||||
@Component({
|
||||
selector: 'page-grid',
|
||||
templateUrl: 'grid.html',
|
||||
providers: [ ProfileService ]
|
||||
selector: "page-grid",
|
||||
templateUrl: "grid.html",
|
||||
providers: [ProfileService],
|
||||
})
|
||||
export class GridPage {
|
||||
|
||||
profiles: any;
|
||||
tabNavEl: any;
|
||||
|
||||
constructor(public navCtrl: NavController, public profileService: ProfileService, private _sanitizer: DomSanitizer) {
|
||||
constructor(
|
||||
public navCtrl: NavController,
|
||||
public profileService: ProfileService,
|
||||
private _sanitizer: DomSanitizer
|
||||
) {
|
||||
profileService.loadVerified().then((data) => {
|
||||
this.profiles = data;
|
||||
console.debug('profiles: ', this.profiles);
|
||||
console.debug("profiles: ", this.profiles);
|
||||
});
|
||||
this.tabNavEl = document.querySelector('#tab-nav .tabbar');
|
||||
this.tabNavEl = document.querySelector("#tab-nav .tabbar");
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.tabNavEl.style.display = 'flex';
|
||||
this.tabNavEl.style.display = "flex";
|
||||
}
|
||||
|
||||
doTellStory() {
|
||||
this.navCtrl.push(TellYourStoryPage);
|
||||
// this.navCtrl.push(TellYourStoryPage);
|
||||
}
|
||||
|
||||
getBackgroundThumbnail(pics) {
|
||||
return this._sanitizer.bypassSecurityTrustStyle('url(https://appsby.fitz.guru/urge/' + pics.thumb + ')');
|
||||
return this._sanitizer.bypassSecurityTrustStyle(
|
||||
"url(/assets/" + pics.thumb + ")"
|
||||
);
|
||||
}
|
||||
|
||||
profilePressed(event, profile) {
|
||||
if (profile.messages && profile.messages.length) {
|
||||
this.navCtrl.push(ChatPage, {
|
||||
profile: profile
|
||||
profile: profile,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,20 @@
|
||||
<ion-list>
|
||||
<ng-container *ngFor="let profile of profiles">
|
||||
<ion-item no-padding *ngIf="profile.messages?.length > 0">
|
||||
<ion-thumbnail padding-left item-start (tap)="profilePictureTapped($event, profile)">
|
||||
<img [src]="'https://appsby.fitz.guru/urge/' + profile.details.pic.thumb">
|
||||
<ion-thumbnail
|
||||
padding-left
|
||||
item-start
|
||||
(tap)="profilePictureTapped($event, profile)"
|
||||
>
|
||||
<img [src]="'/assets/' + profile.details.pic.thumb" />
|
||||
</ion-thumbnail>
|
||||
<ion-grid (tap)="interviewTapped($event, profile)">
|
||||
<ion-row nowrap justify-content-between>
|
||||
<ion-col class="username">
|
||||
{{profile.details.name}}
|
||||
</ion-col>
|
||||
<ion-col class="timestamp" [innerHTML]="getLatestMessageTimestamp(profile.messages)"></ion-col>
|
||||
<ion-col class="username"> {{profile.details.name}} </ion-col>
|
||||
<ion-col
|
||||
class="timestamp"
|
||||
[innerHTML]="getLatestMessageTimestamp(profile.messages)"
|
||||
></ion-col>
|
||||
</ion-row>
|
||||
<ion-row class="latest-message" nowrap>
|
||||
<ion-col [innerHTML]="getLatestMessage(profile.messages)"></ion-col>
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { NavController, NavParams } from 'ionic-angular';
|
||||
import { Component } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { NavController, NavParams } from "ionic-angular";
|
||||
|
||||
import { ChatPage } from '../chat/chat';
|
||||
import { LightboxPage } from '../lightbox/lightbox';
|
||||
import { ProfileService } from '../../services/profiles';
|
||||
import { ChatPage } from "../chat/chat";
|
||||
import { LightboxPage } from "../lightbox/lightbox";
|
||||
import { ProfileService } from "../../services/profiles";
|
||||
|
||||
@Component({
|
||||
selector: 'page-profile',
|
||||
templateUrl: 'profile.html',
|
||||
providers: [ ProfileService ]
|
||||
selector: "page-profile",
|
||||
templateUrl: "profile.html",
|
||||
providers: [ProfileService],
|
||||
})
|
||||
|
||||
export class ProfilePage {
|
||||
|
||||
detailsOpen: boolean = false;
|
||||
profile: any;
|
||||
tabNavEl: any;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams, public profileService: ProfileService, private _sanitizer: DomSanitizer) {
|
||||
this.profile = navParams.get('profile');
|
||||
this.tabNavEl = document.querySelector('#tab-nav .tabbar');
|
||||
constructor(
|
||||
public navCtrl: NavController,
|
||||
public navParams: NavParams,
|
||||
public profileService: ProfileService,
|
||||
private _sanitizer: DomSanitizer
|
||||
) {
|
||||
this.profile = navParams.get("profile");
|
||||
this.tabNavEl = document.querySelector("#tab-nav .tabbar");
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.tabNavEl.style.display = 'none';
|
||||
this.tabNavEl.style.display = "none";
|
||||
}
|
||||
|
||||
closeProfile(event) {
|
||||
@@ -34,17 +37,19 @@ export class ProfilePage {
|
||||
closeProfileDetails(event) {
|
||||
if (this.detailsOpen) {
|
||||
this.detailsOpen = false;
|
||||
document.querySelector('.profile-toolbar').classList.remove('hidden');
|
||||
document.getElementById('detail-overlay').classList.remove('open');
|
||||
document.querySelector(".profile-toolbar").classList.remove("hidden");
|
||||
document.getElementById("detail-overlay").classList.remove("open");
|
||||
}
|
||||
}
|
||||
|
||||
getBackground(pics) {
|
||||
return this._sanitizer.bypassSecurityTrustStyle('url(https://appsby.fitz.guru/urge/' + pics.detail + ')');
|
||||
return this._sanitizer.bypassSecurityTrustStyle(
|
||||
"url(/assets/" + pics.detail + ")"
|
||||
);
|
||||
}
|
||||
|
||||
markFavorite(event, profile) {
|
||||
console.debug('favorite profile', { event: event, profile: profile });
|
||||
console.debug("favorite profile", { event: event, profile: profile });
|
||||
}
|
||||
|
||||
nextProfile(event) {
|
||||
@@ -54,15 +59,15 @@ export class ProfilePage {
|
||||
|
||||
openChat(event, profile) {
|
||||
this.navCtrl.push(ChatPage, {
|
||||
profile: profile
|
||||
profile: profile,
|
||||
});
|
||||
}
|
||||
|
||||
openProfileDetails(event) {
|
||||
if (!this.detailsOpen) {
|
||||
this.detailsOpen = true;
|
||||
document.querySelector('.profile-toolbar').classList.add('hidden');
|
||||
document.getElementById('detail-overlay').classList.add('open');
|
||||
document.querySelector(".profile-toolbar").classList.add("hidden");
|
||||
document.getElementById("detail-overlay").classList.add("open");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +77,9 @@ export class ProfilePage {
|
||||
}
|
||||
|
||||
showLightbox(event, image) {
|
||||
if (event.target.classList.contains('scroll-content')) {
|
||||
if (event.target.classList.contains("scroll-content")) {
|
||||
this.navCtrl.push(LightboxPage, {
|
||||
image: image
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http } from '@angular/http';
|
||||
import 'rxjs/add/operator/map';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Http } from "@angular/http";
|
||||
import "rxjs/add/operator/map";
|
||||
|
||||
@Injectable()
|
||||
export class ProfileService {
|
||||
|
||||
endpoint: string = 'https://api.fitz.guru/urnings/profiles';
|
||||
fallback: string = 'assets/data/profiles.json';
|
||||
epSubmitted: string = '/submitted';
|
||||
epVerified: string = '/verified';
|
||||
endpoint: string = "http://localhost:27017/urnings/profiles";
|
||||
fallback: string = "assets/data/profiles.json";
|
||||
epSubmitted: string = "/submitted";
|
||||
epVerified: string = "/verified";
|
||||
idMap: any = { all: {}, submitted: {}, verified: {} };
|
||||
profiles: any;
|
||||
|
||||
|
||||
constructor(private http: Http) {
|
||||
this.idMap = {};
|
||||
this.idMap = { all: {}, submitted: {}, verified: {} };
|
||||
this.profiles = null;
|
||||
}
|
||||
|
||||
@@ -23,7 +21,7 @@ export class ProfileService {
|
||||
return Promise.resolve(this.profiles);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
this.doGetRequest(this.endpoint, resolve);
|
||||
});
|
||||
}
|
||||
@@ -33,8 +31,8 @@ export class ProfileService {
|
||||
return Promise.resolve(this.profiles.submitted);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.doGetRequest(this.endpoint + this.epSubmitted, resolve, 'submitted');
|
||||
return new Promise((resolve) => {
|
||||
this.doGetRequest(this.endpoint + this.epSubmitted, resolve, "submitted");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,39 +41,42 @@ export class ProfileService {
|
||||
return Promise.resolve(this.profiles.verified);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.doGetRequest(this.endpoint + this.epVerified, resolve, 'verified');
|
||||
return new Promise((resolve) => {
|
||||
this.doGetRequest(this.endpoint + this.epVerified, resolve, "verified");
|
||||
});
|
||||
}
|
||||
|
||||
doGetRequest(endpoint, resolve, type = 'all') {
|
||||
this.http.get(endpoint)
|
||||
.map(res => res.json())
|
||||
doGetRequest(endpoint, resolve, type = "all") {
|
||||
this.http
|
||||
.get(endpoint)
|
||||
.map((res) => res.json())
|
||||
.subscribe(
|
||||
data => {
|
||||
(data) => {
|
||||
this.profiles = this.profiles || {};
|
||||
this.profiles[type] = data;
|
||||
this.profiles[type].reduce((map, profile, i) => {
|
||||
console.log("profile: ", { map, profile, i });
|
||||
map[profile._id] = i;
|
||||
return map;
|
||||
}, this.idMap[type]);
|
||||
resolve(this.profiles[type]);
|
||||
},
|
||||
error => {
|
||||
(error) => {
|
||||
this.doGetRequest(this.fallback, resolve, type);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getNextProfile(id, type = 'all') {
|
||||
getNextProfile(id, type = "all") {
|
||||
var nextIdIndex = this.idMap[type][id] + 1;
|
||||
nextIdIndex = nextIdIndex >= this.profiles[type].length ? 0 : nextIdIndex;
|
||||
return this.profiles[type][nextIdIndex];
|
||||
}
|
||||
|
||||
getPreviousProfile(id, type = 'all') {
|
||||
getPreviousProfile(id, type = "all") {
|
||||
var prevIdIndex = this.idMap[type][id] - 1;
|
||||
prevIdIndex = prevIdIndex < 0 ? (this.profiles[type].length - 1) : prevIdIndex;
|
||||
prevIdIndex =
|
||||
prevIdIndex < 0 ? this.profiles[type].length - 1 : prevIdIndex;
|
||||
return this.profiles[type][prevIdIndex];
|
||||
}
|
||||
|
||||
|
||||
101
backend/bin/www
@@ -1,101 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var app = require('../app');
|
||||
var debug = require('debug')('urge-api:server');
|
||||
var http = require('http');
|
||||
var mongoose = require('mongoose');
|
||||
|
||||
/**
|
||||
* Connect to the Mongo DB
|
||||
*/
|
||||
mongoose.connect('mongodb://localhost:27017/urge', (err) => {
|
||||
if(err) {
|
||||
throw new Error(err);
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '3069');
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
||||
1
backend/data/profiles.json
Normal file
@@ -1,21 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
build: .
|
||||
ports:
|
||||
- "3069:3069"
|
||||
depends_on:
|
||||
- mongo
|
||||
environment:
|
||||
- MONGODB_URI=mongodb://mongo:27017/urge
|
||||
|
||||
mongo:
|
||||
image: mongo:4.4
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- mongo-data:/data/db
|
||||
|
||||
volumes:
|
||||
mongo-data:
|
||||
2542
backend/package-lock.json
generated
@@ -3,7 +3,7 @@
|
||||
"version": "0.2.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www"
|
||||
"start": "node ./src/bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"@google/maps": "^0.4.5",
|
||||
@@ -39,12 +39,6 @@
|
||||
"type": "git",
|
||||
"url": "git@git.mifi.dev:12022/mifi/Pfosi-Looking-API.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Timberland",
|
||||
"TBL",
|
||||
"GCS",
|
||||
"database"
|
||||
],
|
||||
"author": "Mike Fitzpatrick (badmf@mifi.dev)",
|
||||
"license": "ISC"
|
||||
}
|
||||
|
||||
107
backend/src/bin/www
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var app = require("../app");
|
||||
var debug = require("debug")("urge-api:server");
|
||||
var http = require("http");
|
||||
var mongoose = require("mongoose");
|
||||
|
||||
/**
|
||||
* Connect to the Mongo DB
|
||||
*/
|
||||
|
||||
// Use mongo service name for Docker container
|
||||
const mongoUrl = process.env.MONGODB_URL || "mongodb://mongo:27017/urge";
|
||||
|
||||
mongoose
|
||||
.connect(mongoUrl, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
})
|
||||
.then(() => {
|
||||
console.log("Connected to MongoDB successfully");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("MongoDB connection error:", err.message);
|
||||
console.error("Please ensure MongoDB is running on", mongoUrl);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || "3069");
|
||||
app.set("port", port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
server.listen(port);
|
||||
server.on("error", onError);
|
||||
server.on("listening", onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== "listen") {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === "string" ? "Pipe " + port : "Port " + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case "EACCES":
|
||||
console.error(bind + " requires elevated privileges");
|
||||
process.exit(1);
|
||||
break;
|
||||
case "EADDRINUSE":
|
||||
console.error(bind + " is already in use");
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port;
|
||||
debug("Listening on " + bind);
|
||||
}
|
||||
BIN
backend/src/images/cruise/bally_detail.jpg
Executable file
|
After Width: | Height: | Size: 616 KiB |
BIN
backend/src/images/cruise/bally_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 141 KiB |
BIN
backend/src/images/cruise/burlington-garage_detail.jpg
Executable file
|
After Width: | Height: | Size: 370 KiB |
BIN
backend/src/images/cruise/burlington-garage_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 97 KiB |
BIN
backend/src/images/cruise/crowne-plaza-2_detail.jpg
Executable file
|
After Width: | Height: | Size: 381 KiB |
BIN
backend/src/images/cruise/crowne-plaza-2_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 106 KiB |
BIN
backend/src/images/cruise/crowne-plaza_detail.jpg
Executable file
|
After Width: | Height: | Size: 469 KiB |
BIN
backend/src/images/cruise/crowne-plaza_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 139 KiB |
BIN
backend/src/images/cruise/esplanade_detail.jpg
Executable file
|
After Width: | Height: | Size: 748 KiB |
BIN
backend/src/images/cruise/esplanade_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 143 KiB |
BIN
backend/src/images/cruise/first-church_detail.jpg
Executable file
|
After Width: | Height: | Size: 600 KiB |
BIN
backend/src/images/cruise/first-church_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 130 KiB |
BIN
backend/src/images/cruise/fresh-pond_detail.jpg
Executable file
|
After Width: | Height: | Size: 816 KiB |
BIN
backend/src/images/cruise/fresh-pond_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 120 KiB |
BIN
backend/src/images/cruise/joses_detail.jpg
Executable file
|
After Width: | Height: | Size: 746 KiB |
BIN
backend/src/images/cruise/joses_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 221 KiB |
BIN
backend/src/images/cruise/motel6_detail.jpg
Executable file
|
After Width: | Height: | Size: 422 KiB |
BIN
backend/src/images/cruise/motel6_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 106 KiB |
BIN
backend/src/images/cruise/tufts_detail.jpg
Executable file
|
After Width: | Height: | Size: 445 KiB |
BIN
backend/src/images/cruise/tufts_thumbnail.jpg
Executable file
|
After Width: | Height: | Size: 117 KiB |
BIN
backend/src/images/message/2018-03-06-Brian-23.jpg
Normal file
|
After Width: | Height: | Size: 358 KiB |
BIN
backend/src/images/message/2018-03-06-Brian-32.jpg
Normal file
|
After Width: | Height: | Size: 424 KiB |
BIN
backend/src/images/message/IMG_20171119_011320.jpg
Normal file
|
After Width: | Height: | Size: 427 KiB |
BIN
backend/src/images/message/Screenshot_20180129-234423.png
Executable file
|
After Width: | Height: | Size: 466 KiB |
BIN
backend/src/images/message/avery_nick.jpg
Executable file
|
After Width: | Height: | Size: 372 KiB |
BIN
backend/src/images/message/cologne.jpg
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
backend/src/images/message/grindr-screenshot1.png
Executable file
|
After Width: | Height: | Size: 183 KiB |
BIN
backend/src/images/message/grindr-screenshot2.png
Executable file
|
After Width: | Height: | Size: 182 KiB |
BIN
backend/src/images/message/hickey.jpg
Executable file
|
After Width: | Height: | Size: 194 KiB |
BIN
backend/src/images/message/img033.jpg
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
backend/src/images/message/station-pic.jpg
Executable file
|
After Width: | Height: | Size: 153 KiB |
BIN
backend/src/images/profile/profile-b-001_detail.jpg
Executable file
|
After Width: | Height: | Size: 275 KiB |
BIN
backend/src/images/profile/profile-b-001_thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
backend/src/images/profile/profile-j-001_detail.jpg
Normal file
|
After Width: | Height: | Size: 406 KiB |
BIN
backend/src/images/profile/profile-j-001_thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 624 KiB |
BIN
backend/src/images/profile/profile-m-001_detail.jpg
Normal file
|
After Width: | Height: | Size: 573 KiB |
BIN
backend/src/images/profile/profile-m-001_thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 64 KiB |