You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Development/v4.x/Migration.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,10 @@
1
-
## Migrating from the old SciCat Backend
1
+
# Migrating from the old SciCat Backend
2
+
3
+
SciCat v4.x is a major rewrite from [v3.x](https://github.com/SciCatProject/backend-v3). The backend has been rewritten in typescript. It uses NestJS rather than Loopback 3 for the API, and includes a large number of new features. Version 3 is now considered deprecated and will receive only maintenance updates.
4
+
5
+
This document is intended to help users of backend-v3 migrate to v4. It also describes major breaking changes between the two versions that will need to be updated in scicat clients or scripts.
6
+
7
+
## Database changes
2
8
3
9
Where the [current SciCat Backend](https://github.com/SciCatProject/backend) accepts id fields in the database named `pid`, `doi`, or similar, this implementation requires there to be an id field of the form `_id` on every document. It is therefore necessary to run a database migration script towards MongoDB instance from a place where you have access to it and can install `migrate-mongo` package.
4
10
@@ -16,20 +22,39 @@ if `migrate-mongo` is installed globally at the location where you want to run i
16
22
./node_modules/migrate-mongo/bin/migrate-mongo.js up
17
23
```
18
24
25
+
## API changes
26
+
27
+
### Base URL
28
+
29
+
The scicat API was previously served at `/api/v3`. Many of the endpoints are backwards
30
+
compatible and are still served at the same address. However, several schemas have added
31
+
non-backwards-compabible features (eg. `Datasets`, `Attachements`, and `Jobs`). For
32
+
these it is recommended to access the new `/api/v4` endpoints. Old `/api/v3` endpoints
33
+
are still available for backwards compatibility, but will be removed in a future
34
+
version.
35
+
36
+
<!-- TODO: provide more details about the updated DTOs -->
37
+
38
+
### Authorization
39
+
40
+
Version 3 endpoints were authenticated by including an `access_token` query parameter in
41
+
the URL. Following best practices, this has been changed to use the HTTP `Authorization:
42
+
Bearer` header to pass the access token. All scicat clients must be updated for this
43
+
change, even those using the otherwise backwards-compatible `/api/v3` endpoints.
44
+
19
45
## Migration documentation and NestJs resources
20
46
Following are the post that I found useful working on the migration:
21
47
- Schema and DTOs: https://betterprogramming.pub/how-to-use-data-transfer-objects-dto-for-validation-in-nest-js-7ff95309f650
-[Custom validation with datasbase in NestJs](https://dev.to/avantar/custom-validation-with-database-in-nestjs-gao)
25
-
-[Validating nested objects with class-validator in NestJs](https://dev.to/avantar/validating-nested-objects-with-class-validator-in-nestjs-1gn8)
51
+
-[Validating nested objects with class-validator in NestJs](https://dev.to/avantar/validating-nested-objects-with-class-validator-in-nestjs-1gn8)
26
52
-[Validating numeric query parameters in NestJS](https://dev.to/avantar/validating-numeric-query-parameters-in-nestjs-gk9)
27
53
-[Injecting request object to a custom validation class in NestJS](https://dev.to/avantar/injecting-request-object-to-a-custom-validation-class-in-nestjs-5dal)
For the full documentation please go to the [SciCat home page](https://scicatproject.github.io/) and follow the [documentation link](https://scicatproject.github.io/documentation)
0 commit comments