-
Notifications
You must be signed in to change notification settings - Fork 9
/
local_history.patch
247 lines (247 loc) · 8.33 KB
/
local_history.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Index: src/app/services/__tests__/tmdb-commands.integration.spec.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/app/services/__tests__/tmdb-commands.integration.spec.js (date 1510648957000)
+++ src/app/services/__tests__/tmdb-commands.integration.spec.js (date 1510648957000)
@@ -0,0 +1,17 @@
+import { retrieveATmdbFilm, searchTmdbFilm } from '../tmdb-commands'
+
+describe('Tmdb client', () => {
+
+ it('finds searched film', async () => {
+ const result = await searchTmdbFilm('Princess Mononoke')
+ expect(result.id).toBe(128)
+ expect(result.backdrop_path).toContain('image.tmdb.org')
+ expect(result.backdrop_path).toContain('.jpg')
+ expect(result.poster_path).toContain('.jpg')
+ })
+
+ it('Gets a film by url', async () => {
+ const film = await retrieveATmdbFilm(128)
+ expect(typeof film.title).toBe('string')
+ })
+})
Index: src/app/services/__tests__/ghibli-commands.integration.spec.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/app/services/__tests__/ghibli-commands.integration.spec.js (date 1510652143000)
+++ src/app/services/__tests__/ghibli-commands.integration.spec.js (date 1510652143000)
@@ -0,0 +1,20 @@
+
+describe('GhibliCommands', () => {
+
+ it('Gets all films', async () => {
+ const films = await retrieveAllFilms()
+ expect(films.length).toBeGreaterThan(19)
+ films.map((film) => expect(typeof film.title).toBe('string'))
+ })
+
+ it('Gets a film', async () => {
+ const film = await buildGhibliCommand().retrieveAFilm('578ae244-7750-4d9f-867b-f3cd3d6fecf4')
+ expect(typeof film.title).toBe('string')
+ })
+
+ it('Gets a film by url', async () => {
+ const URL = 'https://ghibliapi.herokuapp.com/films/578ae244-7750-4d9f-867b-f3cd3d6fecf4'
+ const film = await buildGhibliCommand().open(URL)
+ expect(typeof film.title).toBe('string')
+ })
+})
Index: src/app/services/__tests__/tmdb-client.integration.spec.js
===================================================================
--- src/app/services/__tests__/tmdb-client.integration.spec.js (date 0)
+++ src/app/services/__tests__/tmdb-client.integration.spec.js (date 0)
@@ -1,17 +0,0 @@
-import { retrieveATmdbFilm, searchTmdbFilm } from '../tmdb-commands'
-
-describe('Tmdb client', () => {
-
- it('finds searched film', async () => {
- const result = await searchTmdbFilm('Princess Mononoke')
- expect(result.id).toBe(128)
- expect(result.backdrop_path).toContain('image.tmdb.org')
- expect(result.backdrop_path).toContain('.jpg')
- expect(result.poster_path).toContain('.jpg')
- })
-
- it('Gets a film by url', async () => {
- const film = await retrieveATmdbFilm(128)
- expect(typeof film.title).toBe('string')
- })
-})
Index: src/app/services/__tests__/ghibli-command.integration.spec.js
===================================================================
--- src/app/services/__tests__/ghibli-command.integration.spec.js (date 0)
+++ src/app/services/__tests__/ghibli-command.integration.spec.js (date 0)
@@ -1,21 +0,0 @@
-import { buildGhibliCommand } from '../ghibli-commands'
-
-describe('GhibliCommands', () => {
-
- it('Gets all films', async () => {
- const films = await buildGhibliCommand().retrieveAllFilms()
- expect(films.length).toBeGreaterThan(19)
- films.map((film) => expect(typeof film.title).toBe('string'))
- })
-
- it('Gets a film', async () => {
- const film = await buildGhibliCommand().retrieveAFilm('578ae244-7750-4d9f-867b-f3cd3d6fecf4')
- expect(typeof film.title).toBe('string')
- })
-
- it('Gets a film by url', async () => {
- const URL = 'https://ghibliapi.herokuapp.com/films/578ae244-7750-4d9f-867b-f3cd3d6fecf4'
- const film = await buildGhibliCommand().open(URL)
- expect(typeof film.title).toBe('string')
- })
-})
Index: src/app/services/tmbd-client.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/app/services/tmbd-client.js (date 1510649081000)
+++ src/app/services/tmbd-client.js (date 1510649081000)
@@ -0,0 +1,34 @@
+import { backendClient } from './backend-client'
+const client = backendClient()
+
+export async function searchTmdbFilm(title) {
+ const backdropBase = 'https://image.tmdb.org/t/p/w780/'
+ const posterBase = 'https://image.tmdb.org/t/p/w300/'
+ const response = await tmdbCommand('search/movie', { query: title }).run()
+ const movie = response.results[0]
+ movie.backdrop_path = backdropBase + movie.backdrop_path
+ movie.poster_path = posterBase + movie.poster_path
+ return movie
+}
+
+export function retrieveATmdbFilm(id) {
+ return tmdbCommand('movie/' + id).run()
+}
+
+function tmdbCommand(sufix, payload) {
+ const API_KEY = 'b32fc40cf588f4eb1c274d51147af792'
+ const baseUrl = 'https://api.themoviedb.org/3/'
+ const command = {
+ url: baseUrl + sufix,
+ payload: {
+ api_key: API_KEY,
+ language: 'en-US',
+ ...payload
+ }
+ }
+ return { ...command, run }
+
+ function run() {
+ return client.run(command)
+ }
+}
Index: src/app/services/GhibliRouter.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/app/services/GhibliRouter.js (date 1510652110000)
+++ src/app/services/GhibliRouter.js (date 1510652110000)
@@ -0,0 +1,29 @@
+import VueRouter from 'vue-router'
+
+export const GhibliRouter = (router) => {
+ if (!router) router = new VueRouter()
+ return { navigateToFilm, navigateToCreateGig, navigateToAllGigs, getParam }
+
+ function navigateToFilm(id1, id2) {
+ router.push(`film/${id1}/${id2}`)
+ }
+
+ function navigateToCreateGig() {
+ router.push({path: '/newGig'})
+ }
+
+ function navigateToAllGigs() {
+ router.push({path: '/all'})
+ }
+
+ function getParam(id) {
+ if (!router) return ''
+ return router.currentRoute.params[id]
+ }
+}
+
+export const ghibliRouterMixin = {
+ created: function () {
+ this.ghibliRouter = GhibliRouter(this.$router)
+ }
+}
Index: src/app/services/ghibli-client.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/app/services/ghibli-client.js (date 1510651985000)
+++ src/app/services/ghibli-client.js (date 1510651985000)
@@ -0,0 +1,3 @@
+// this commands have the same name that they have in our backend
+export const RETRIEVE_ALL_FILMS = 'retrieve_all_films'
+export const RETRIEVE_FILM = 'retrieve_film'
Index: src/app/services/JotaRouter.js
===================================================================
--- src/app/services/JotaRouter.js (date 0)
+++ src/app/services/JotaRouter.js (date 0)
@@ -1,29 +0,0 @@
-import VueRouter from 'vue-router'
-
-export const JotaRouter = (router) => {
- if (!router) router = new VueRouter()
- return { navigateToFilm, navigateToCreateGig, navigateToAllGigs, getParam }
-
- function navigateToFilm(id1, id2) {
- router.push(`film/${id1}/${id2}`)
- }
-
- function navigateToCreateGig() {
- router.push({path: '/newGig'})
- }
-
- function navigateToAllGigs() {
- router.push({path: '/all'})
- }
-
- function getParam(id) {
- if (!router) return ''
- return router.currentRoute.params[id]
- }
-}
-
-export const jotaRouterMixin = {
- created: function () {
- this.jotaRouter = JotaRouter(this.$router)
- }
-}
Index: src/app/services/jota-payloads.js
===================================================================
--- src/app/services/jota-payloads.js (date 0)
+++ src/app/services/jota-payloads.js (date 0)
@@ -1,9 +0,0 @@
-export function createGigPayload(title, dateTime) {
- return {
- title: title,
- day: dateTime.substring(0, 10),
- description: 'Fake gig created by jota-api',
- place: 'Fake place',
- image_url: 'https://pbs.twimg.com/profile_images/727103317168394240/fY7WRP5T_400x400.jpg'
- }
-}
Index: src/app/services/jota-instances.js
===================================================================
--- src/app/services/jota-instances.js (date 0)
+++ src/app/services/jota-instances.js (date 0)
@@ -1,3 +0,0 @@
-import { GigService, Matcher } from '../fake-backend/JotaCore'
-
-export const gigService = new GigService(new Matcher())