Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.6 release #579

Merged
merged 176 commits into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
2bf6670
Added Polished module for Sass Mixin in theme, Implement UI for Event…
paulpichot Aug 12, 2019
df7729c
Simplify the DevNotice for production and developpement mode
paulpichot Aug 12, 2019
9361839
Common changes on body, main page container and header
paulpichot Aug 12, 2019
e51b2b1
Style change on common components
paulpichot Aug 12, 2019
8f9240e
UI implementation on HowTo List Page
paulpichot Aug 12, 2019
ee1d735
UI implementation on Event Page
paulpichot Aug 12, 2019
9122cb9
add images and fix css problem for logo-background and menu-current i…
paulpichot Aug 12, 2019
6efa4d9
missing FlagIcon File
paulpichot Aug 12, 2019
3e4bcd7
Merge pull request #537 from OneArmyWorld/ui-test-events
BenGamma Aug 12, 2019
3359510
Merge branch 'master' into new-ui-preciousplastic
BenGamma Aug 12, 2019
83d9003
Styling of the How To page
paulpichot Aug 13, 2019
17ff767
Clearing components, UI How to
paulpichot Aug 14, 2019
1c1f565
Factoring header, starting implement design system
paulpichot Aug 15, 2019
10cffa9
Factoring main container
paulpichot Aug 15, 2019
f665f04
Dev Helpers
paulpichot Aug 15, 2019
e55dd61
Header and main files
paulpichot Aug 15, 2019
1a6c692
Main file
paulpichot Aug 15, 2019
ac74965
Breadcrumb how to
paulpichot Aug 15, 2019
77f34d2
Merge branch 'master' into new-ui-preciousplastic
BenGamma Aug 15, 2019
5772ffb
fix conflicts with master
BenGamma Aug 15, 2019
7a36f49
fix caption display & clean step image container
BenGamma Aug 16, 2019
bb52afb
start mobile menu
BenGamma Aug 16, 2019
b731651
theme implementation
paulpichot Aug 18, 2019
2464819
Fix bug
paulpichot Aug 19, 2019
e76e0ad
Added font & factor howtocard and eventcard
paulpichot Aug 20, 2019
d90a1ae
style gallery image how-to
paulpichot Aug 20, 2019
109ff45
responsive how-to
paulpichot Aug 20, 2019
252b4ba
style popup map
paulpichot Aug 20, 2019
722d5ad
resolve merge conflicts with master
BenGamma Aug 21, 2019
e2ccad7
merge wip on mobile
BenGamma Aug 21, 2019
0eba59d
colors & how to create
paulpichot Aug 21, 2019
70eda49
fix conflicts with v0.6-new-ui-pp
BenGamma Aug 21, 2019
0709967
display HowToCard with width={1} & remove <picture> element around Ho…
BenGamma Aug 21, 2019
d21dbe0
added a tertiary button, login & join button style"
paulpichot Aug 21, 2019
cae6e5d
button style
paulpichot Aug 21, 2019
89bed66
clarify Text & Heading component to more generic naming
BenGamma Aug 21, 2019
b8409c3
export const instead of React class component for stateless components
BenGamma Aug 21, 2019
4f4b272
headings & image gallery fix"
paulpichot Aug 21, 2019
baa2b1e
fix naming class button
paulpichot Aug 22, 2019
f703606
Button size props
paulpichot Aug 23, 2019
eae3646
fix button class login
paulpichot Aug 23, 2019
f639605
Merge pull request #544 from OneArmyWorld/ui-test-events
BenGamma Aug 23, 2019
c6ef0a2
Form styling to fit Create How-To, Intro
paulpichot Aug 23, 2019
605845c
menu mobile display breakpoint earlier
paulpichot Aug 23, 2019
b0ca524
responsive intro create how to
paulpichot Aug 23, 2019
b5a19a6
styling steps create how to and input images
paulpichot Aug 23, 2019
4317fc7
style dropwdown select'
paulpichot Aug 23, 2019
fd45e6f
Event create styling
paulpichot Aug 23, 2019
4ecadc8
responsive event create"
paulpichot Aug 23, 2019
306034f
Event responsive
paulpichot Aug 26, 2019
d5e0a19
fix image border radius
paulpichot Aug 26, 2019
ec8ee4f
frame setting page
paulpichot Aug 26, 2019
517c199
settings page & buttons disabled style
paulpichot Aug 27, 2019
80cf2e7
Profil frame & modal
paulpichot Aug 27, 2019
064eb2d
profile
paulpichot Aug 28, 2019
9e6e88e
update title to createEvent fields
BenGamma Aug 29, 2019
c88c321
merge master and fix conflicts
BenGamma Aug 29, 2019
0fca053
fix conflicts with v0.6_new_ui_pp
BenGamma Aug 29, 2019
6557ab7
Merge pull request #547 from ONEARMY/ui-work-v06
BenGamma Aug 29, 2019
dac5486
rename filteredHowtos to filteredCollectionByTags and move fn to modu…
BenGamma Sep 2, 2019
3901d24
allow tag filtering on events
BenGamma Sep 2, 2019
6893ea1
add filter defaults
chrismclarke Sep 2, 2019
06eb100
Merge pull request #559 from ONEARMY/557_events_filtering_by_tags
BenGamma Sep 2, 2019
1153364
create method filteredCollectionByLocation in common module store
BenGamma Sep 3, 2019
9b57684
add LocationSearch component on EventsList
BenGamma Sep 3, 2019
436c4f4
filter events list by location & tags
BenGamma Sep 3, 2019
c5123a1
create onClear method on LocationSearch component to update event lis…
BenGamma Sep 3, 2019
57cbd82
call onclear props on algolia event
BenGamma Sep 3, 2019
76475ad
rename functions filteredCollectionBy to filterCollectionBy for consi…
BenGamma Sep 3, 2019
ae7b83b
refacto filteredEvents for more readability
BenGamma Sep 3, 2019
a076482
fix conflict
BenGamma Sep 3, 2019
4d50ad1
Merge pull request #560 from ONEARMY/558_filter_events_by_location
chrismclarke Sep 4, 2019
dfa3476
merge master
BenGamma Sep 4, 2019
61374a4
Merge branch 'v0.6_new_ui_pp' of https://github.com/ONEARMY/community…
BenGamma Sep 4, 2019
c350259
fix algolia search icon
BenGamma Sep 4, 2019
6b7ca7f
update version number
BenGamma Sep 4, 2019
dc16423
remove discussion dependencies - remove all occurence of Discussion s…
BenGamma Sep 4, 2019
8ca0897
Merge pull request #562 from ONEARMY/561_archive_discussion_page
BenGamma Sep 4, 2019
9022042
fix conflicts with master
BenGamma Sep 5, 2019
cb35593
wip add EditHowto page - create common form for create & edit howto
BenGamma Sep 5, 2019
1bcd76a
fix unique key error
BenGamma Sep 5, 2019
4f81829
add parentType prop on HowtoForm
BenGamma Sep 5, 2019
898e6cc
buttons
paulpichot Sep 5, 2019
c3ccb2c
add edit button in how-to description
BenGamma Sep 5, 2019
81ba71e
inject existing data in edit form TODO : inject tags and images
BenGamma Sep 5, 2019
eb45000
create onSubmit() props to howtoform - add exception on form dependin…
BenGamma Sep 5, 2019
dbd7353
little text update on howtoFrom
BenGamma Sep 5, 2019
db429ff
more link
paulpichot Sep 5, 2019
0468312
pages login & password
paulpichot Sep 5, 2019
7325dbb
pages sign-in sign-up
paulpichot Sep 9, 2019
b376b21
allow cover_image editing
BenGamma Sep 10, 2019
f48f6af
replace index key with _id on howto list
BenGamma Sep 10, 2019
188eb12
Using rootDir in whatchPlugins
porcelani Sep 10, 2019
798adbe
Merge pull request #567 from porcelani/master
chrismclarke Sep 10, 2019
3438a32
allow edit step image
BenGamma Sep 10, 2019
dcb211f
wip display existing tags on howto edit
BenGamma Sep 10, 2019
2c09c84
allow edit of the files
BenGamma Sep 10, 2019
2e7a2e9
wip submit edit howto form
BenGamma Sep 10, 2019
320a509
update node version
chrismclarke Sep 10, 2019
32f2411
add backend dh token functions and code tidying
chrismclarke Sep 10, 2019
d48d82f
add user store dh login bindings and login buttons
chrismclarke Sep 10, 2019
c028fac
refactor ILocation to fix user model functions import
chrismclarke Sep 10, 2019
4c3468d
update dh login endpoint
chrismclarke Sep 10, 2019
c21e566
fix tags select value load and existing image upload
chrismclarke Sep 10, 2019
a652bc9
update doc meta instead of rewrite on howto edit
BenGamma Sep 10, 2019
b255697
display edit button only to howto creator
BenGamma Sep 11, 2019
1bf1634
add profile delete methods and ui
chrismclarke Sep 11, 2019
d32046b
fix signup with missing /
BenGamma Sep 11, 2019
15a11e5
use user as props instead of username to allow super-admin users to s…
BenGamma Sep 11, 2019
23d4b3e
update events and location mock and models
chrismclarke Sep 11, 2019
5140983
remove event map
chrismclarke Sep 11, 2019
3667693
improve filter typings
chrismclarke Sep 11, 2019
3ffd1e4
add dbV2 doc generator and improve typings
chrismclarke Sep 11, 2019
a7b576c
refactor db store methods for dbV2
chrismclarke Sep 11, 2019
e9c1810
refactor event components for changed data format
chrismclarke Sep 11, 2019
2feedbd
improve edit button display condition
BenGamma Sep 11, 2019
4fa6ea7
create isAllowToEditContent fn as helper
BenGamma Sep 11, 2019
2861fcf
allow only super-admin & creator or content to edit how-to
BenGamma Sep 11, 2019
6e8fa40
display submitStatus modal onSubmit
BenGamma Sep 11, 2019
9ba6315
add preLine prop to description
BenGamma Sep 11, 2019
8a10e6c
fix conflicts with v0.6
BenGamma Sep 11, 2019
e4f56ae
Merge pull request #566 from ONEARMY/ui-work-v06
BenGamma Sep 11, 2019
61be9e3
Merge branch 'v0.6_new_ui_pp' into 103_how_to_edit_mode
BenGamma Sep 11, 2019
c4fd6a9
Merge pull request #568 from ONEARMY/module/auth
BenGamma Sep 11, 2019
2f6c24f
fix conflicts with master
BenGamma Sep 11, 2019
bf83fd2
fix ILocation src
BenGamma Sep 11, 2019
6cdc9cb
Merge pull request #570 from ONEARMY/refactor/events-backend
BenGamma Sep 11, 2019
759a473
fix conflicts with master
BenGamma Sep 11, 2019
7994664
fix conflicts with v0.6
BenGamma Sep 11, 2019
5144f2b
Merge pull request #564 from ONEARMY/103_how_to_edit_mode
chrismclarke Sep 12, 2019
2c4eedc
Merge branch 'master' into feat/user-profile-delete
chrismclarke Sep 12, 2019
8d22613
update howto model and db bindings
chrismclarke Sep 12, 2019
1dc846a
improve db query methods and typings
chrismclarke Sep 12, 2019
a3a0645
- Add ErrorMessage element
tudi2d Sep 12, 2019
ad84d70
Merge remote-tracking branch 'upstream/master' into 542-improve-form-…
tudi2d Sep 12, 2019
6a953ff
Merge pull request #569 from ONEARMY/feat/user-profile-delete
BenGamma Sep 12, 2019
9d202ac
add link to sign-up and sign-in page on header login buttons
BenGamma Sep 12, 2019
e49ba4f
Merge pull request #574 from tudi2d/542-improve-form-validation
BenGamma Sep 12, 2019
5a34b8f
fix conflicts with master
BenGamma Sep 12, 2019
54c2a1b
make onClear() prop optional to avoid undefined callback
BenGamma Sep 12, 2019
34e351a
use _id as key for eventList
BenGamma Sep 12, 2019
ce6daaf
refacto components/MoreContainer
BenGamma Sep 12, 2019
75ab12a
Merge branch 'v0.6_new_ui_pp' into 571_signup_signin_page_usable
BenGamma Sep 12, 2019
ae45fca
wip sign-in working
BenGamma Sep 12, 2019
dfcf9e1
Merge pull request #576 from ONEARMY/v0.6_new_ui_pp
chrismclarke Sep 13, 2019
2b1b52b
update module, event and tags store for dbV2
chrismclarke Sep 13, 2019
49482f5
remove legacy db
chrismclarke Sep 13, 2019
167afae
merge master
BenGamma Sep 13, 2019
82da213
remove old db from provider
chrismclarke Sep 13, 2019
411f9ff
Merge branch 'master' into 571_signup_signin_page_usable
BenGamma Sep 13, 2019
b746202
fix duplicating how to bug
chrismclarke Sep 13, 2019
8502f47
Merge pull request #573 from ONEARMY/refactor/how-tos
BenGamma Sep 13, 2019
e3fa7d0
Merge branch 'master' of https://github.com/ONEARMY/community-platfor…
chrismclarke Sep 13, 2019
041af3f
display errors on sign-in & redirect to / onSuccess
BenGamma Sep 13, 2019
1a12e9d
allow user sign-up
BenGamma Sep 13, 2019
b5d1b1b
update store db bindings
chrismclarke Sep 13, 2019
a1a22f3
improve db typings
chrismclarke Sep 13, 2019
a2890c2
improve example store template
chrismclarke Sep 13, 2019
4864206
make module store base path optional
chrismclarke Sep 13, 2019
d40f22d
update various component bindings
chrismclarke Sep 13, 2019
fbf5c06
Merge pull request #577 from ONEARMY/571_signup_signin_page_usable
BenGamma Sep 13, 2019
1af669c
WiP - collection updates
chrismclarke Sep 13, 2019
278bced
hotfix - update node version
chrismclarke Sep 13, 2019
d57e97d
Merge branch 'master' of https://github.com/ONEARMY/community-platform
chrismclarke Sep 13, 2019
250ca5d
Merge branch 'master' of https://github.com/ONEARMY/community-platfor…
chrismclarke Sep 13, 2019
7bba10b
Merge pull request #578 from ONEARMY/refactor/all-stores
BenGamma Sep 13, 2019
406b205
fix styles for TagsSelect and back button
BenGamma Sep 13, 2019
5a9447d
add tags to howto page description
BenGamma Sep 13, 2019
d3b3d84
remove fieldContainer on fileInputField
BenGamma Sep 13, 2019
57973ae
add placeholder prop to TagsSelect & increaze size of howtoStep form …
BenGamma Sep 13, 2019
a063692
fix conditionto display step image upload
BenGamma Sep 13, 2019
d78552e
display Avatar if logged in
BenGamma Sep 13, 2019
15a6635
fix display of multiple fields in userSettings
BenGamma Sep 13, 2019
446d607
add styleVariant prop to locationSearch
BenGamma Sep 13, 2019
19168f8
only display My pin btn on map for logged in users
BenGamma Sep 13, 2019
5d5927f
hotfix - dbdoc types
chrismclarke Sep 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .storybook/theme-decorator.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { RenderFunction } from '@storybook/react'
import * as React from 'react'
import { ThemeProvider } from 'styled-components'
import theme from '../src/themes/styled.theme'
import { RenderFunction } from '@storybook/react';
import * as React from 'react';
import { ThemeProvider } from 'styled-components';
import theme from 'src/themes/styled.theme';

export default (storyFn: RenderFunction) => (
<ThemeProvider theme={theme}>{storyFn()}</ThemeProvider>
)
export default (storyFn: RenderFunction) => <ThemeProvider theme={theme}>{storyFn()}</ThemeProvider>;
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '8'
- '10'
dist: trusty
sudo: false
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"typescript": "^3.2.2"
},
"engines": {
"node": "8"
"node": "10"
},
"private": true
}
43 changes: 37 additions & 6 deletions functions/src/DaveHakkensNL/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
import { migrateAvatar } from './avatarMigrate'
import { updateDHUserIds, getDHUserProfile } from './dataMigrate'
import { getDHUserProfile } from './dataMigrate'
import { DHLogin } from './login'

export default {
updateDHUserIds,
migrateAvatar,
getDHUserProfile,
}
import * as functions from 'firebase-functions'

const DHSite_getUser = functions.https.onCall(async (mention_name: string) => {
console.log('getting DH user profile', mention_name)
try {
const profile = await getDHUserProfile(mention_name)
return profile
} catch (error) {
throw new functions.https.HttpsError('not-found', error.message)
}
})

const DHSite_migrateAvatar = functions.https.onCall(
async ({ avatarUrl, user }) => {
console.log('migrating user avatar', user, avatarUrl)
try {
const meta = await migrateAvatar(avatarUrl, user)
return meta
} catch (error) {
throw new functions.https.HttpsError('not-found', error.message)
}
},
)

const DHSite_login = functions.https.onCall(async ({ email, password }) => {
try {
const token = await DHLogin(email, password)
return token
} catch (error) {
console.log(error.message)
throw new functions.https.HttpsError('permission-denied', error.message)
}
})

export const DH_Exports = { DHSite_getUser, DHSite_migrateAvatar, DHSite_login }
106 changes: 106 additions & 0 deletions functions/src/DaveHakkensNL/login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
const endpoint = 'https://davehakkens.nl/wp-json/aam/v1/authenticate'
import axios from 'axios'
import { firebaseAdmin } from '../Firebase/admin'
// tslint:disable no-implicit-dependencies
import { IUser } from '@OAModels/user.models'

export const DHLogin = async (username: string, password: string) => {
const dhJWT = await DHGetJWTToken(username, password)
const userId = dhJWT.user.data.user_login
const claims = mergeDhData(dhJWT)
return firebaseAdmin.auth().createCustomToken(userId, claims)
}

// Use AAM plugin on DH site to generate JWT token from DH site
// User credentials are validated and a JWT token passed back on successful user login
const DHGetJWTToken = async (username: string, password: string) => {
const body = { username, password }
const headers = {
'Content-Type': 'application/json',
Accept: 'application/json',
}
const res = await axios.post(endpoint, body, { headers: headers })
const token: IDHTokenResponse = res.data
return token
}

// when logging in via dh site a JWT token is returned with a variety of user profile information
// want to extract data from token and format in way consistent with other users (OpenIDConnect)
// and fields that will be used in the platform
const mergeDhData = (dhJWT: IDHTokenResponse) => {
const oidcClaims = {
email: dhJWT.user.data.user_email,
name: dhJWT.user.data.display_name,
}
const additionalUserClaims: Partial<IUser> = {
DHSite_id: dhJWT.user.ID,
DHSite_mention_name: dhJWT.user.data.user_login,
}
return { ...oidcClaims, ...additionalUserClaims }
}

/********************************************************************************************************
* Interfaces and Mocks
*********************************************************************************************************/
interface IDHTokenResponse {
token: string
token_expires: string
user: {
data: {
ID: string
user_login: string
user_pass: string
user_nicename: string
user_email: string
user_url: string
user_registered: string
user_activation_key: string
user_status: string
display_name: string
}
ID: number
caps: {
subscriber: boolean
}
cap_key: string
roles: string[]
allcaps: {
read: boolean
level_0: boolean
subscriber: boolean
}
filter: null
}
}

const LOGIN_MOCK: IDHTokenResponse = {
token:
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NjgxMjcxNzQsImlzcyI6Imh0dHA6XC9cL3Rlc3R3cC5vbmVhcm15LndvcmxkIiwiZXhwIjoiMDlcLzExXC8yMDE5LCAxNDo1MiArMDAwMCIsImp0aSI6ImM2OGE1YWViLWJjZjQtNDNmOS1iYjJiLTFmODVmNDc2YTEyNSIsInVzZXJJZCI6MiwicmV2b2NhYmxlIjp0cnVlLCJyZWZyZXNoYWJsZSI6ZmFsc2V9.4yxRenweWSJ69gNg_2RhqxpMozBN29FGODcx82L5a7A',
token_expires: '09/11/2019, 14:52 +0000',
user: {
data: {
ID: '2',
user_login: 'testwp',
user_pass: '$P$Bw2/hfTcHvHXLKawFMST3OSE5CxmIN0',
user_nicename: 'testwp',
user_email: 'testwp@test.com',
user_url: '',
user_registered: '2019-09-10 11:55:34',
user_activation_key: '',
user_status: '0',
display_name: 'testwp',
},
ID: 2,
caps: {
subscriber: true,
},
cap_key: 'wp_capabilities',
roles: ['subscriber'],
allcaps: {
read: true,
level_0: true,
subscriber: true,
},
filter: null,
},
}
7 changes: 3 additions & 4 deletions functions/src/Firebase/firebaseSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// import { IDBEndpoint } from '@OAModels/common.models'
import * as rtdb from './realtimeDB'
import * as firestore from './firestoreDB'
import { IDBEndpoint, IDbDoc } from '../models'
import { IDBEndpoint, DBDoc } from '../models'

/* Functions in this folder are used to sync data between firestore and firebase realtime databases
The reason for this is to allow large collections to be 'cached' for cheap retrieval
Expand All @@ -14,7 +14,6 @@ import { IDBEndpoint, IDbDoc } from '../models'
*/

const endpoints: IDBEndpoint[] = [
'v2_discussions',
'v2_events',
'v2_howtos',
'v2_mappins',
Expand All @@ -37,7 +36,7 @@ export const sync = async (endpoint: IDBEndpoint) => {
const existing = await rtdb.get(endpoint)
const latest =
existing && Object.keys(existing).length > 1
? Object.values<IDbDoc>(existing).sort((a, b) => _sortByModified(a, b))[0]
? Object.values<DBDoc>(existing).sort((a, b) => _sortByModified(a, b))[0]
._modified
: ''

Expand All @@ -52,7 +51,7 @@ export const sync = async (endpoint: IDBEndpoint) => {
return json
}

function _sortByModified(a: IDbDoc, b: IDbDoc) {
function _sortByModified(a: DBDoc, b: DBDoc) {
return a._modified > b._modified ? -1 : 1
}

Expand Down
4 changes: 2 additions & 2 deletions functions/src/Firebase/firestoreDB.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { firebaseAdmin } from './admin'
import { IDbDoc, IDBEndpoint } from '../models'
import { DBDoc, IDBEndpoint } from '../models'

export const db = firebaseAdmin.firestore()

Expand All @@ -25,5 +25,5 @@ export const getCollection = (endpoint: IDBEndpoint) =>
.collection(endpoint)
.get()
.then(snapshot => {
return snapshot.empty ? [] : snapshot.docs.map(d => d.data() as IDbDoc)
return snapshot.empty ? [] : snapshot.docs.map(d => d.data() as DBDoc)
})
11 changes: 6 additions & 5 deletions functions/src/exports/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import * as functions from 'firebase-functions'
import * as bodyParser from 'body-parser'
import * as cors from 'cors'
import * as express from 'express'
import * as sync from '../Firebase/firebaseSync'
import { upgradeDBAll } from '../upgrade/dbV1Upgrade'
import { DHLogin } from '../DaveHakkensNL/login'

console.log('api ready')
const app = express()
Expand Down Expand Up @@ -47,10 +46,12 @@ app.all('*', async (req, res, next) => {
// const upgradeStatus = await upgradeDBAll()
// res.send(upgradeStatus)
// break
case 'sync':
console.log('sync test')
case 'DHSite_login':
console.log('dh login test', JSON.stringify(req.body))
try {
const d = await sync.syncAll()
const { username, password } = req.body
console.log('testing login', username, password)
const d = await DHLogin(username, password)
res.send(d)
} catch (error) {
console.log(error)
Expand Down
26 changes: 0 additions & 26 deletions functions/src/exports/dhsite.ts

This file was deleted.

4 changes: 2 additions & 2 deletions functions/src/exports/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Add/change schedule from `./functions-cron/appengine/cron.yaml`
************************************************************************************/

import * as functions from 'firebase-functions'
import DHSite from '../DaveHakkensNL'
import { BackupDatabase } from '../Firebase/databaseBackup'
import * as FirebaseSync from '../Firebase/firebaseSync'
import { updateDHUserIds } from '../DaveHakkensNL/dataMigrate'

export const weeklyTasks = functions.pubsub
.topic('weekly-tick')
Expand All @@ -20,6 +20,6 @@ export const dailyTasks = functions.pubsub
.topic('daily-tick')
.onPublish(async (message, context) => {
console.log('daily tick', message, context)
DHSite.updateDHUserIds()
updateDHUserIds()
FirebaseSync.syncAll()
})
7 changes: 4 additions & 3 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { api } from './exports/api'
import { weeklyTasks, dailyTasks } from './exports/tasks'
import { DHSite_getUser, DHSite_migrateAvatar } from './exports/dhsite'
import { DH_Exports } from './DaveHakkensNL'

// the following endpoints are exposed for use by various triggers
// see individual files for more informaiton
exports.api = api
exports.weeklyTasks = weeklyTasks
exports.dailyTasks = dailyTasks
exports.DHSite_getUser = DHSite_getUser
exports.DHSite_migrateAvatar = DHSite_migrateAvatar
exports.DHSite_getUser = DH_Exports.DHSite_getUser
exports.DHSite_migrateAvatar = DH_Exports.DHSite_migrateAvatar
exports.DHSite_login = DH_Exports.DHSite_login
4 changes: 2 additions & 2 deletions functions/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// Models can be imported from the main package for use here
// NOTE 1 - this requires adjustment main src in package.json
// NOTE 2 - shorthand @OAModels notation defined in tsconfig
import { IDBEndpoint, IDbDoc } from '@OAModels/common.models'
import { IDBEndpoint, DBDoc } from '@OAModels/common.models'

export { IDBEndpoint, IDbDoc }
export { IDBEndpoint, DBDoc }
15 changes: 2 additions & 13 deletions functions/src/upgrade/dbV1Upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { db } from '../Firebase/firestoreDB'
*/

const mappings: DBMapping = {
discussions: 'v2_discussions',
eventsV1: 'v2_events',
howtosV1: 'v2_howtos',
tagsV1: 'v2_tags',
Expand Down Expand Up @@ -79,16 +78,6 @@ function _upgradeDate(date: any) {

type DBMapping = { [key in IDBEndpointV1]: IDBEndpointV2 }

type IDBEndpointV1 =
| 'howtosV1'
| 'users'
| 'discussions'
| 'tagsV1'
| 'eventsV1'
type IDBEndpointV1 = 'howtosV1' | 'users' | 'tagsV1' | 'eventsV1'

type IDBEndpointV2 =
| 'v2_howtos'
| 'v2_users'
| 'v2_discussions'
| 'v2_tags'
| 'v2_events'
type IDBEndpointV2 = 'v2_howtos' | 'v2_users' | 'v2_tags' | 'v2_events'
Loading