Skip to content

Commit

Permalink
✨ introducing the first version of the titra API [experimental]
Browse files Browse the repository at this point in the history
📦 upgrading meteor to version 1.8.2
  • Loading branch information
faburem committed Nov 15, 2019
1 parent d2b785d commit b0d3ef2
Show file tree
Hide file tree
Showing 14 changed files with 669 additions and 239 deletions.
10 changes: 5 additions & 5 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

[email protected] # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
mongo@1.6.2 # The database Meteor supports right now
mongo@1.7.0 # The database Meteor supports right now
[email protected] # Compile .html files into Meteor Blaze views
[email protected] # Reactive variable for tracker
[email protected] # Meteor's client-side reactive programming library

[email protected].3 # CSS minifier run for production mode
standard-minifier-js@2.4.1 # JS minifier run for production mode
[email protected].4 # CSS minifier run for production mode
standard-minifier-js@2.5.0 # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers.
ecmascript@0.12.4 # Enable ECMAScript2015+ syntax in app code
ecmascript@0.13.0 # Enable ECMAScript2015+ syntax in app code
[email protected] # Server-side component of the `meteor shell` command

fourseven:[email protected]
Expand All @@ -30,6 +30,6 @@ faburem:client-server-logger
[email protected]
kadira:blaze-layout
kadira:flow-router
http
http@1.4.2
brettle:accounts-anonymous
brettle:accounts-add-service
2 changes: 1 addition & 1 deletion .meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[email protected].1
[email protected].2
32 changes: 16 additions & 16 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[email protected].4
[email protected].5
[email protected]
aldeed:[email protected]
[email protected]
[email protected]
babel-compiler@7.3.4
babel-runtime@1.3.0
babel-compiler@7.4.0
babel-runtime@1.4.0
[email protected]
[email protected]
[email protected]
Expand All @@ -19,7 +19,7 @@ brettle:[email protected]
brettle:[email protected]
[email protected]
[email protected]
callback-hook@1.1.0
callback-hook@1.2.0
[email protected]
[email protected]
[email protected]
Expand All @@ -29,10 +29,10 @@ [email protected]
[email protected]
[email protected]
[email protected]
ecmascript@0.12.7
ecmascript@0.13.0
[email protected]
ecmascript-runtime-client@0.8.0
ecmascript-runtime-server@0.7.1
ecmascript-runtime-client@0.9.0
ecmascript-runtime-server@0.8.0
[email protected]
[email protected]
[email protected]
Expand All @@ -56,21 +56,21 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].2
minifier-js@2.4.1
[email protected].3
minifier-js@2.5.0
[email protected]
[email protected]
[email protected]
[email protected]
modules@0.13.0
modules-runtime@0.10.3
mongo@1.6.3
modules@0.14.0
modules-runtime@0.11.0
mongo@1.7.0
[email protected]
[email protected]
[email protected]
mouse0270:[email protected]
[email protected]
npm-mongo@3.1.2
npm-mongo@3.2.0
[email protected]
[email protected]
ostrio:[email protected]
Expand All @@ -91,8 +91,8 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].3
standard-minifier-js@2.4.1
[email protected].4
standard-minifier-js@2.5.0
[email protected]
[email protected]
[email protected]
Expand All @@ -101,5 +101,5 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].4
[email protected].5
[email protected]
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8.15.1
FROM node:8.16.2
ENV METEOR_ALLOW_SUPERUSER true
RUN curl https://install.meteor.com/ | sh
RUN meteor --version
Expand All @@ -12,7 +12,7 @@ COPY imports/ ./imports/
COPY .meteor/ ./.meteor/
RUN meteor build /build/ --server-only --architecture os.linux.x86_64

FROM node:8.15.1
FROM node:8.16.2-slim
RUN apt-get update && apt-get install -y python make g++ && rm -rf /var/lib/apt/lists/*
COPY --from=0 /build/*.tar.gz /app/bundle.tar.gz
WORKDIR /app/
Expand Down
30 changes: 18 additions & 12 deletions imports/api/timecards/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ import {

const replacer = (match) => emoji.emojify(match)

function insertTimeCard(projectId, task, date, hours, userId) {
if (!Tasks.findOne({ userId, name: task.replace(/(:.*:)/g, replacer) })) {
Tasks.insert({ userId, lastUsed: new Date(), name: task.replace(/(:.*:)/g, replacer) })
} else {
Tasks.update({ userId, name: task.replace(/(:.*:)/g, replacer) }, { $set: { lastUsed: new Date() } })
}
return Timecards.insert({
userId,
projectId,
date,
hours,
task: task.replace(/(:.*:)/g, replacer),
})
}

Meteor.methods({
insertTimeCard({
projectId,
Expand All @@ -33,18 +48,7 @@ Meteor.methods({
check(date, Date)
check(hours, Number)
checkAuthentication(this)
if (!Tasks.findOne({ userId: this.userId, name: task.replace(/(:.*:)/g, replacer) })) {
Tasks.insert({ userId: this.userId, lastUsed: new Date(), name: task.replace(/(:.*:)/g, replacer) })
} else {
Tasks.update({ userId: this.userId, name: task.replace(/(:.*:)/g, replacer) }, { $set: { lastUsed: new Date() } })
}
Timecards.insert({
userId: this.userId,
projectId,
date,
hours,
task: task.replace(/(:.*:)/g, replacer),
})
insertTimeCard(projectId, task, date, hours, this.userId)
},
updateTimeCard({
projectId,
Expand Down Expand Up @@ -255,3 +259,5 @@ Meteor.methods({
return workingHoursObject
},
})

export { insertTimeCard }
3 changes: 3 additions & 0 deletions imports/api/users/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Meteor.methods({
breakStartTime,
breakDuration,
regularWorkingTime,
APItoken,
}) {
check(name, String)
check(unit, String)
Expand All @@ -33,6 +34,7 @@ Meteor.methods({
check(breakStartTime, String)
check(breakDuration, String)
check(regularWorkingTime, String)
check(APItoken, String)
checkAuthentication(this)
Meteor.users.update({ _id: this.userId }, {
$set: {
Expand All @@ -45,6 +47,7 @@ Meteor.methods({
'profile.precision': precision,
'profile.siwapptoken': siwapptoken,
'profile.siwappurl': siwappurl,
'profile.APItoken': APItoken,
'profile.theme': theme,
'profile.language': language,
'profile.dailyStartTime': dailyStartTime,
Expand Down
3 changes: 0 additions & 3 deletions imports/ui/components/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,4 @@ Template.calendar.helpers({
{ sort: { name: 1 } },
)
},
colorOpacity(hex, op) {
return hex2rgba(hex || '#009688', !isNaN(op) ? op : 50)
},
})
15 changes: 15 additions & 0 deletions imports/ui/pages/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@
{{t "settings.integrations"}}
</div>
<div class="card-block">
<div class="card form-group">
<div class="card-header">
titra API token
</div>
<div class="card-block">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" id="titraAPItoken" value="{{titraAPItoken}}" />
<div class="input-group-append">
<button class="btn btn-outline-primary" type="button" id="generateToken">Generate</button>
</div>
</div>
</div>
</div>
</div>
<div class="card form-group">
<div class="card-header">
Wekan
Expand Down
7 changes: 7 additions & 0 deletions imports/ui/pages/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor'
import { Random } from 'meteor/random'
import moment from 'moment'
import i18next from 'i18next'
import './settings.html'
Expand Down Expand Up @@ -39,6 +40,7 @@ Template.settings.helpers({
},
siwappurl: () => (Meteor.user() ? Meteor.user().profile.siwappurl : false),
siwapptoken: () => (Meteor.user() ? Meteor.user().profile.siwapptoken : false),
titraAPItoken: () => (Meteor.user() ? Meteor.user().profile.APItoken : false),
dailyStartTime: () => (Meteor.user() ? Meteor.user().profile.dailyStartTime : '09:00'),
breakStartTime: () => (Meteor.user() ? Meteor.user().profile.breakStartTime : '12:00'),
breakDuration: () => (Meteor.user() ? Meteor.user().profile.breakDuration : 0.5),
Expand All @@ -58,6 +60,7 @@ Template.settings.events({
precision: Number($('#precision').val()),
siwapptoken: $('#siwapptoken').val(),
siwappurl: $('#siwappurl').val(),
APItoken: $('#titraAPItoken').val(),
theme: $('#theme').val(),
language: $('#language').val(),
dailyStartTime: $('#dailyStartTime').val(),
Expand All @@ -79,6 +82,10 @@ Template.settings.events({
event.preventDefault()
Meteor.logout()
},
'click #generateToken': (event) => {
event.preventDefault()
$('#titraAPItoken').val(Random.id())
},
})
Template.settings.onCreated(function settingsCreated() {
this.displayHoursToDays = new ReactiveVar()
Expand Down
Loading

0 comments on commit b0d3ef2

Please sign in to comment.