Skip to content

Commit be49169

Browse files
committed
Merge branch 'master' into 1913-update-jobs-v3-tests
2 parents 6f137ac + fcb3fa6 commit be49169

File tree

5 files changed

+360
-140
lines changed

5 files changed

+360
-140
lines changed

Development/v4.x/Migration.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff 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
28

39
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.
410

@@ -16,20 +22,39 @@ if `migrate-mongo` is installed globally at the location where you want to run i
1622
./node_modules/migrate-mongo/bin/migrate-mongo.js up
1723
```
1824

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+
1945
## Migration documentation and NestJs resources
2046
Following are the post that I found useful working on the migration:
2147
- Schema and DTOs: https://betterprogramming.pub/how-to-use-data-transfer-objects-dto-for-validation-in-nest-js-7ff95309f650
2248
- Validation:
2349
- [Official documentation](https://docs.nestjs.com/techniques/validation)
2450
- [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)
2652
- [Validating numeric query parameters in NestJS](https://dev.to/avantar/validating-numeric-query-parameters-in-nestjs-gk9)
2753
- [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)
2854
- Swagger and OpenAPI:
2955
- https://docs.nestjs.com/openapi/introduction
3056
- https://docs.nestjs.com/openapi/types-and-parameters
3157
- https://docs.nestjs.com/openapi/decorators
32-
3358
---
3459

3560
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)

Development/v4.x/backend/configuration.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,26 @@ _src/config/configuration.ts_
8787
_example_: "group1,group2,group3,..."
8888

8989
- DELETE\_JOB\_GROUPS:
90-
list of non admin groups that are allowed to delete jobs for groups
91-
they do not belong to. If set to "#all", all users can delete a job belonging to
92-
any group.
90+
groups that are allowed to delete jobs. If set to "#all", all users can delete a job
91+
belonging to any group.
9392
_default_: ""
9493
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
9594
_example_: "group1,group2,group3,..."
9695

96+
- CREATE\_JOB\_PRIVILEGED\_GROUPS:
97+
Comma separated list of groups with permission to create any job.
98+
For more details check: [Jobs Authorization](authorization/authorization_jobs.md)
99+
_default_: ""
100+
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
101+
_example_: "archivemanager,jobmanager"
102+
103+
- UPDATE\_JOB\_PRIVILEGED\_GROUPS:
104+
Comma separated list of groups with permission to update any job.
105+
For more details check: [Jobs Authorization](authorization/authorization_jobs.md)
106+
_default_: ""
107+
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
108+
_example_: "archivemanager,jobmanager"
109+
97110
- ACCESS\_GROUPS\_STATIC\_VALUES:
98111
List of groups assigned by default to all users. Used in the vanilla implementation
99112
for easy configuration. If you do not want or need to assign any default group, it
@@ -477,3 +490,13 @@ _src/config/configuration.ts_
477490
If omitted, the jobs subsystem is inactive.
478491
_default_: "jobConfig.yaml", optional.
479492
_format_: string
493+
494+
- JOB\_DEFAULT\_STATUS\_CODE:
495+
Default statusCode for new jobs
496+
_default_: "jobSubmitted", optional.
497+
_format_: string
498+
499+
- JOB\_DEFAULT\_STATUS\_MESSAGE
500+
Default statusMessage for new jobs
501+
_default_: "Job submitted.", optional.
502+
_format_: string

0 commit comments

Comments
 (0)