Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SudoGeeks_TalkingReminder
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
RAUSHAN RAJ
SudoGeeks_TalkingReminder
Commits
bf6c39af
Commit
bf6c39af
authored
Nov 27, 2019
by
RAUSHAN RAJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete index.ts
parent
d06eacba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
81 deletions
+0
-81
Source/functions/src/index.ts
Source/functions/src/index.ts
+0
-81
No files found.
Source/functions/src/index.ts
deleted
100644 → 0
View file @
d06eacba
import
*
as
functions
from
'
firebase-functions
'
;
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
// export const helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });
export
const
onMessageCreate
=
function
.
database
.
ref
(
'
/rooms/{roomid}/message/{messageid}
'
)
.
onCreate
((
snapshot
,
context
)
=>
{
const
roomId
=
context
.
params
.
roomId
const
messageId
=
context
.
params
.
messageId
const
messageData
=
snapshot
.
val
()
const
text
=
addpizzazz
(
messageData
.
text
)
return
snapshot
.
ref
.
update
({
text
:
text
})
})
function
addpizzazz
(
text
:
string
):
string
{
return
text
.
replace
()
}
export
const
onMessageUpdate
=
function
.
database
.
ref
(
'
/rooms/{roomid}/message/{messageid}
'
)
.
onUpdate
((
change
,
context
)
=>
{
const
before
=
change
.
before
.
val
()
const
after
=
change
.
after
.
val
()
if
(
before
.
text
===
after
.
text
){
return
null
}
const
text
=
addpizzazz
(
after
.
text
)
const
timeedited
=
Date
.
now
()
return
chnage
.
after
.
ref
.
update
({
text
:
text
})
})
function
addpizzazz
(
text
:
string
):
string
{
return
text
.
replace
()
}
/////////////////////////////////////////////////////////////////////
export
const
onMessageCreate
=
function
.
database
.
ref
(
'
/rooms/{roomid}/message/{messageid}
'
)
.
onCreate
(
async
(
snapshot
,
context
)
=>
{
const
roomId
=
context
.
params
.
roomId
const
messageId
=
context
.
params
.
messageId
const
messageData
=
snapshot
.
val
()
const
text
=
addpizzazz
(
messageData
.
text
)
await
snapshot
.
ref
.
update
({
text
:
text
})
const
countRef
=
snapshot
.
ref
.
parent
.
parent
.
child
(
'
messageCount
'
)
return
countRef
.
transaction
(
count
=>
{
return
count
+
1
})
})
export
const
onMessageDelete
=
function
.
database
.
ref
(
'
/rooms/{roomid}/message/{messageid}
'
)
.
onDelete
(
async
(
snapshot
,
context
)
=>
{
const
countRef
=
snapshot
.
ref
.
parent
.
parent
.
child
(
'
messageCount
'
)
return
countRef
.
transaction
(
count
=>
{
return
count
-
1
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment