Skip to content

Commit b10aeeb

Browse files
Merge remote-tracking branch 'origin/main' into fix/input-styles-in-profile
2 parents 8218ef9 + 9f2bfc3 commit b10aeeb

26 files changed

Lines changed: 386 additions & 126 deletions

App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { enableAndroidBackgroundNotificationListener, startMockedServer } from '
1111
import * as Device from 'expo-device'
1212
import 'expo-router/entry'
1313

14-
// FIXME: moking not working on mobile app - follow this discussion https://github.com/mswjs/msw/issues/2026
1514
const ENABLE_MOCKED_SERVER = false
1615

1716
if (ENABLE_MOCKED_SERVER) {

App.web.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import '@baca/i18n'
1010
import { startMockedServer } from '@baca/services'
1111
import 'expo-router/entry'
1212

13-
// FIXME: moking not working on mobile app - follow this discussion https://github.com/mswjs/msw/issues/2026
1413
const ENABLE_MOCKED_SERVER = false
1514

1615
if (ENABLE_MOCKED_SERVER) {

orval.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ export default defineConfig({
88
target: 'src/api/query/model.ts',
99
schemas: 'src/api/types',
1010
client: 'react-query',
11-
mock: true,
11+
// solution for not working mocked data on mobile - it removes automatically added "*" to address url at the beginning
12+
mock: {
13+
baseUrl: '',
14+
type: 'msw',
15+
},
1216
clean: true,
1317
prettier: true,
1418
override: {

scripts/data/swagger-spec.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,20 @@
12111211
},
12121212
"tags": ["health"]
12131213
}
1214+
},
1215+
"/api/v1/system/app-updates/check": {
1216+
"post": {
1217+
"operationId": "SystemController_checkForAppUpdate",
1218+
"parameters": [],
1219+
"requestBody": {
1220+
"required": true,
1221+
"content": {
1222+
"application/json": { "schema": { "$ref": "#/components/schemas/CheckUpdateDto" } }
1223+
}
1224+
},
1225+
"responses": { "201": { "description": "" } },
1226+
"tags": ["system"]
1227+
}
12141228
}
12151229
},
12161230
"info": {
@@ -1829,7 +1843,7 @@
18291843
"properties": {
18301844
"accessToken": {
18311845
"type": "string",
1832-
"example": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFlOGI2ZTFlYTI1Y2I2M2Q0ZTI5YWI1Y2M2ZDZmODBlZjRmNDY2NjciLCJ0eXAiOiJKV1QifQ.eyJhenAiOiIxMjM0NTY3ODkwMTIzNDU2Nzg5MC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImF1ZCI6IjEyMzQ1Njc4OTAxMjM0NTY3ODkwLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZXhwIjoxNjUxNTc2MDAwLCJpYXQiOjE2NTE1NzI0MDAsImlzcyI6ImFjY291bnRzLmdvb2dsZS5jb20iLCJzdWIiOiIxMjM0NTY3ODkwMTIzNDU2Nzg5MCIsImVtYWlsIjoianVzdHVzZXJAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm5hbWUiOiJKdXN0IFVzZXIiLCJwaWN0dXJlIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9qdXN0dXNlci9waG90by5qcGciLCJnaXZlbl9uYW1lIjoiSnVzdCIsImZhbWlseV9uYW1lIjoiVXNlciJ9.QWxsYWtoemF0aGtqZGxza2FqaGRsa2FqZGxza2FqZGhza2FqaGRrc2FqaGtqZHNhbGtqZHNhbGtqZGhsYWtqZHNhbGtqaGRsYWtqaGRza2FqaGRrc2FqaGRrc2FqaGRrc2Fq",
1846+
"example": "EAAJ3MZA...ZDZD",
18331847
"description": "Google Access token obtained after user authentication using Google OAuth. Use this token to authenticate the request to the application."
18341848
}
18351849
},
@@ -1915,6 +1929,23 @@
19151929
}
19161930
},
19171931
"required": ["status", "info", "error", "details"]
1932+
},
1933+
"CheckUpdateDto": {
1934+
"type": "object",
1935+
"properties": {
1936+
"os": {
1937+
"type": "string",
1938+
"example": "ios",
1939+
"description": "The operating system for which to check the update. Can be either \"android\" or \"ios\".",
1940+
"enum": ["android", "ios"]
1941+
},
1942+
"currentVersion": {
1943+
"type": "string",
1944+
"example": "1.2.0",
1945+
"description": "The current version of the app installed on the device."
1946+
}
1947+
},
1948+
"required": ["os", "currentVersion"]
19181949
}
19191950
}
19201951
},

src/api/query/articles/articles.msw.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export const getArticlesControllerUpdateResponseMock = (
149149
})
150150

151151
export const getArticlesControllerCreateMockHandler = (overrideResponse?: ArticleEntity) => {
152-
return http.post('*/api/v1/articles', async () => {
152+
return http.post('/api/v1/articles', async () => {
153153
await delay(1000)
154154
return new HttpResponse(
155155
JSON.stringify(
@@ -166,7 +166,7 @@ export const getArticlesControllerCreateMockHandler = (overrideResponse?: Articl
166166
}
167167

168168
export const getArticlesControllerFindAllMockHandler = (overrideResponse?: ArticleEntity[]) => {
169-
return http.get('*/api/v1/articles', async () => {
169+
return http.get('/api/v1/articles', async () => {
170170
await delay(1000)
171171
return new HttpResponse(
172172
JSON.stringify(
@@ -183,7 +183,7 @@ export const getArticlesControllerFindAllMockHandler = (overrideResponse?: Artic
183183
}
184184

185185
export const getArticlesControllerFindDraftsMockHandler = (overrideResponse?: ArticleEntity[]) => {
186-
return http.get('*/api/v1/articles/drafts', async () => {
186+
return http.get('/api/v1/articles/drafts', async () => {
187187
await delay(1000)
188188
return new HttpResponse(
189189
JSON.stringify(
@@ -200,7 +200,7 @@ export const getArticlesControllerFindDraftsMockHandler = (overrideResponse?: Ar
200200
}
201201

202202
export const getArticlesControllerFindOneMockHandler = (overrideResponse?: ArticleEntity) => {
203-
return http.get('*/api/v1/articles/:id', async () => {
203+
return http.get('/api/v1/articles/:id', async () => {
204204
await delay(1000)
205205
return new HttpResponse(
206206
JSON.stringify(
@@ -217,7 +217,7 @@ export const getArticlesControllerFindOneMockHandler = (overrideResponse?: Artic
217217
}
218218

219219
export const getArticlesControllerUpdateMockHandler = (overrideResponse?: ArticleEntity) => {
220-
return http.patch('*/api/v1/articles/:id', async () => {
220+
return http.patch('/api/v1/articles/:id', async () => {
221221
await delay(1000)
222222
return new HttpResponse(
223223
JSON.stringify(
@@ -234,7 +234,7 @@ export const getArticlesControllerUpdateMockHandler = (overrideResponse?: Articl
234234
}
235235

236236
export const getArticlesControllerRemoveMockHandler = () => {
237-
return http.delete('*/api/v1/articles/:id', async () => {
237+
return http.delete('/api/v1/articles/:id', async () => {
238238
await delay(1000)
239239
return new HttpResponse(null, {
240240
status: 200,

src/api/query/auth-social/auth-social.msw.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const getAuthAppleControllerLoginResponseMock = (
144144
})
145145

146146
export const getAuthGoogleControllerLoginMockHandler = (overrideResponse?: AuthEntity) => {
147-
return http.post('*/api/v1/auth/google/login', async () => {
147+
return http.post('/api/v1/auth/google/login', async () => {
148148
await delay(1000)
149149
return new HttpResponse(
150150
JSON.stringify(
@@ -161,7 +161,7 @@ export const getAuthGoogleControllerLoginMockHandler = (overrideResponse?: AuthE
161161
}
162162

163163
export const getAuthFacebookControllerLoginMockHandler = (overrideResponse?: AuthEntity) => {
164-
return http.post('*/api/v1/auth/facebook/login', async () => {
164+
return http.post('/api/v1/auth/facebook/login', async () => {
165165
await delay(1000)
166166
return new HttpResponse(
167167
JSON.stringify(
@@ -178,7 +178,7 @@ export const getAuthFacebookControllerLoginMockHandler = (overrideResponse?: Aut
178178
}
179179

180180
export const getAuthAppleControllerLoginMockHandler = (overrideResponse?: AuthEntity) => {
181-
return http.post('*/api/v1/auth/apple/login', async () => {
181+
return http.post('/api/v1/auth/apple/login', async () => {
182182
await delay(1000)
183183
return new HttpResponse(
184184
JSON.stringify(

src/api/query/auth/auth.msw.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const getAuthControllerRefreshResponseMock = (
135135
})
136136

137137
export const getAuthControllerLoginMockHandler = (overrideResponse?: AuthEntity) => {
138-
return http.post('*/api/v1/auth/email/login', async () => {
138+
return http.post('/api/v1/auth/email/login', async () => {
139139
await delay(1000)
140140
return new HttpResponse(
141141
JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerLoginResponseMock()),
@@ -150,7 +150,7 @@ export const getAuthControllerLoginMockHandler = (overrideResponse?: AuthEntity)
150150
}
151151

152152
export const getAuthControllerRegisterMockHandler = (overrideResponse?: UserEntity) => {
153-
return http.post('*/api/v1/auth/email/register', async () => {
153+
return http.post('/api/v1/auth/email/register', async () => {
154154
await delay(1000)
155155
return new HttpResponse(
156156
JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerRegisterResponseMock()),
@@ -165,7 +165,7 @@ export const getAuthControllerRegisterMockHandler = (overrideResponse?: UserEnti
165165
}
166166

167167
export const getAuthControllerConfirmEmailMockHandler = () => {
168-
return http.post('*/api/v1/auth/email/confirm', async () => {
168+
return http.post('/api/v1/auth/email/confirm', async () => {
169169
await delay(1000)
170170
return new HttpResponse(null, {
171171
status: 200,
@@ -177,7 +177,7 @@ export const getAuthControllerConfirmEmailMockHandler = () => {
177177
}
178178

179179
export const getAuthControllerResendVerificationEmailMockHandler = () => {
180-
return http.post('*/api/v1/auth/email/resend', async () => {
180+
return http.post('/api/v1/auth/email/resend', async () => {
181181
await delay(1000)
182182
return new HttpResponse(null, {
183183
status: 200,
@@ -189,7 +189,7 @@ export const getAuthControllerResendVerificationEmailMockHandler = () => {
189189
}
190190

191191
export const getAuthControllerForgotPasswordMockHandler = () => {
192-
return http.post('*/api/v1/auth/forgot/password', async () => {
192+
return http.post('/api/v1/auth/forgot/password', async () => {
193193
await delay(1000)
194194
return new HttpResponse(null, {
195195
status: 200,
@@ -201,7 +201,7 @@ export const getAuthControllerForgotPasswordMockHandler = () => {
201201
}
202202

203203
export const getAuthControllerResetPasswordMockHandler = () => {
204-
return http.post('*/api/v1/auth/reset/password', async () => {
204+
return http.post('/api/v1/auth/reset/password', async () => {
205205
await delay(1000)
206206
return new HttpResponse(null, {
207207
status: 200,
@@ -213,7 +213,7 @@ export const getAuthControllerResetPasswordMockHandler = () => {
213213
}
214214

215215
export const getAuthControllerEmailChangeMockHandler = () => {
216-
return http.post('*/api/v1/auth/email/change', async () => {
216+
return http.post('/api/v1/auth/email/change', async () => {
217217
await delay(1000)
218218
return new HttpResponse(null, {
219219
status: 200,
@@ -225,7 +225,7 @@ export const getAuthControllerEmailChangeMockHandler = () => {
225225
}
226226

227227
export const getAuthControllerConfirmEmailChangeMockHandler = () => {
228-
return http.post('*/api/v1/auth/email/change-confirm', async () => {
228+
return http.post('/api/v1/auth/email/change-confirm', async () => {
229229
await delay(1000)
230230
return new HttpResponse(null, {
231231
status: 200,
@@ -237,7 +237,7 @@ export const getAuthControllerConfirmEmailChangeMockHandler = () => {
237237
}
238238

239239
export const getAuthControllerMeMockHandler = (overrideResponse?: UserEntity) => {
240-
return http.get('*/api/v1/auth/me', async () => {
240+
return http.get('/api/v1/auth/me', async () => {
241241
await delay(1000)
242242
return new HttpResponse(
243243
JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerMeResponseMock()),
@@ -252,7 +252,7 @@ export const getAuthControllerMeMockHandler = (overrideResponse?: UserEntity) =>
252252
}
253253

254254
export const getAuthControllerUpdateMockHandler = () => {
255-
return http.patch('*/api/v1/auth/me', async () => {
255+
return http.patch('/api/v1/auth/me', async () => {
256256
await delay(1000)
257257
return new HttpResponse(null, {
258258
status: 200,
@@ -264,7 +264,7 @@ export const getAuthControllerUpdateMockHandler = () => {
264264
}
265265

266266
export const getAuthControllerDeleteMockHandler = () => {
267-
return http.delete('*/api/v1/auth/me', async () => {
267+
return http.delete('/api/v1/auth/me', async () => {
268268
await delay(1000)
269269
return new HttpResponse(null, {
270270
status: 200,
@@ -276,7 +276,7 @@ export const getAuthControllerDeleteMockHandler = () => {
276276
}
277277

278278
export const getAuthControllerRefreshMockHandler = (overrideResponse?: RefreshEntity) => {
279-
return http.post('*/api/v1/auth/refresh', async () => {
279+
return http.post('/api/v1/auth/refresh', async () => {
280280
await delay(1000)
281281
return new HttpResponse(
282282
JSON.stringify(overrideResponse ? overrideResponse : getAuthControllerRefreshResponseMock()),
@@ -291,7 +291,7 @@ export const getAuthControllerRefreshMockHandler = (overrideResponse?: RefreshEn
291291
}
292292

293293
export const getAuthControllerLogoutMockHandler = () => {
294-
return http.post('*/api/v1/auth/logout', async () => {
294+
return http.post('/api/v1/auth/logout', async () => {
295295
await delay(1000)
296296
return new HttpResponse(null, {
297297
status: 200,
@@ -303,7 +303,7 @@ export const getAuthControllerLogoutMockHandler = () => {
303303
}
304304

305305
export const getAuthControllerLogoutAllMockHandler = () => {
306-
return http.post('*/api/v1/auth/logout/all', async () => {
306+
return http.post('/api/v1/auth/logout/all', async () => {
307307
await delay(1000)
308308
return new HttpResponse(null, {
309309
status: 200,

src/api/query/files/files.msw.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getFilesControllerUploadFileResponseMock = (
2626
})
2727

2828
export const getFilesControllerUploadFileMockHandler = (overrideResponse?: FileEntity) => {
29-
return http.post('*/api/v1/files/upload', async () => {
29+
return http.post('/api/v1/files/upload', async () => {
3030
await delay(1000)
3131
return new HttpResponse(
3232
JSON.stringify(
@@ -43,7 +43,7 @@ export const getFilesControllerUploadFileMockHandler = (overrideResponse?: FileE
4343
}
4444

4545
export const getFilesControllerDownloadMockHandler = () => {
46-
return http.get('*/api/v1/files/:fileName', async () => {
46+
return http.get('/api/v1/files/:fileName', async () => {
4747
await delay(1000)
4848
return new HttpResponse(null, {
4949
status: 200,
@@ -55,7 +55,7 @@ export const getFilesControllerDownloadMockHandler = () => {
5555
}
5656

5757
export const getFilesControllerDeleteFileMockHandler = () => {
58-
return http.delete('*/api/v1/files/:fileName', async () => {
58+
return http.delete('/api/v1/files/:fileName', async () => {
5959
await delay(1000)
6060
return new HttpResponse(null, {
6161
status: 200,

src/api/query/health/health.msw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const getHealthControllerCheckResponseMock = (overrideResponse: any = {})
3030
})
3131

3232
export const getHealthControllerCheckMockHandler = (overrideResponse?: HealthEntity) => {
33-
return http.get('*/api/v1/health', async () => {
33+
return http.get('/api/v1/health', async () => {
3434
await delay(1000)
3535
return new HttpResponse(
3636
JSON.stringify(overrideResponse ? overrideResponse : getHealthControllerCheckResponseMock()),

src/api/query/system/system.msw.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/**
3+
* Generated by orval 🍺
4+
* Do not edit manually.
5+
* API
6+
* API documentation for the starter-kit project in NestJS by BinarApps. The API allows management of users, sessions and offers various functions for logged in users. Contains examples of authentication, authorization, and CRUD for selected resources.
7+
* OpenAPI spec version: 1.0
8+
*/
9+
import { HttpResponse, delay, http } from 'msw'
10+
11+
export const getSystemControllerCheckForAppUpdateMockHandler = () => {
12+
return http.post('*/api/v1/system/app-updates/check', async () => {
13+
await delay(1000)
14+
return new HttpResponse(null, {
15+
status: 200,
16+
headers: {
17+
'Content-Type': 'application/json',
18+
},
19+
})
20+
})
21+
}
22+
export const getSystemMock = () => [getSystemControllerCheckForAppUpdateMockHandler()]

0 commit comments

Comments
 (0)