# API docs api.wikiarchives.space
## Structure BDD
## File
```php
/**
* Name of the file Key used by the filesystem to identify the file
* example: picture.png
* @var string
* @Odm\Field(type="string")
*/
private string $name;
/**
* @var string
* @Odm\Field(type="string")
*/
private string $mimeType;
/**
* @var string
* @Odm\Field(type="string")
*/
private string $originalFileName;
/**
* A sha256 hash
* @var string
* @Odm\Field(type="string")
*/
private string $hash;
```
```
name: string
mimeType: string
originalFileName: string
hash: string # SHA 256
```
## users
```
_id: ObjectId,
username: string,
password: string,
email: string,
role: contributor | moderator | administrator,
isLocked: bool,
isVerified: bool,
isDeleted: bool,
score: int,
lastLoginAt: DATE_TIME,
createdAt: DATE_TIME,
updatedAt: DATE_TIME,
deletedAt: DATE_TIME,
avatar: FileObject,
publicName: string,
location: string,
biography: string
```
## changeset (2nd version)
A changeset represent a session of changment
Each user can have at max 1 'draft' changeset
```
@Collection
ObjectChange:
_id: ObjectId
reference (ou object): ReferenceOne(Catalog|Picture)
status: string 'draft|pending|rejected|accepted'
userComment: ?string
moderatorComment: ?string
createdBy: ReferenceOne(User)
fieldChanges: EmbedMany(FieldChange)
createdAt: datetime
validatedAt: datetime
```
```
@Embed
FieldChange:
_id: ObjectId
path: string (JSONPATH of the property affected) position.lng
type: string 'new|delete|edit'
before: any
after: any
```
When we merge change into the master branch we check that the 'before' match the current value before replacing it with the 'after' value.
This check ensure that there are no conflict during this merge process. (aka nobody modified the value at the ~samish time)
## catalogs
```
_id: ObjectId
name: string
description: string
parentId: ObjectId
thumbnailId: ObjectId
isEditable: boolean
createdAt: DATE_TIME,
updatedAt: DATE_TIME
```
## pictures
```
_id: ObjectId,
catalogId: ObjectId,
# métas entré par l'user
name: string, # ou id_agency
description: string,
source: string,
placeId: ObjectId,
position: { lat: float, lng: float },
takenAt: datetime,
exif: {
model: string,
manufacturer: string,
aperture: string,
iso: int,
exposure: string,
focalLength: float,
flash: bool
...
}
license: {
name: Can be one of: [
null,
'CC BY',
'CC BY-SA',
'CC BY-ND',
'CC BY-NC',
'CC BY-NC-SA',
'CC BY-NC-ND',
'CC BY-SA 3.0 IGO',
'All rights reserved'
'Public Domain'
]
isModified: boolean (default: false)
}
# autogénéré
typeMime: string,
hash: string, # sha256
originalFileName: string
resolutions: [
{
file: FileObject,
width: int,
height: int,
size: int,
label: 'xs'|'m'|'xl'|'original'
}
]
createdAt: DATE_TIME,
updatedAt: DATE_TIME
```
### places
```
_id: string
name: string,
description: string,
pictureId: ObjectID,
wikipedia???
position: { lat: float, lng: float },
createdAt: DATE_TIME,
updatedAt: DATE_TIME
```
## Identification
* POST /login
* POST /register
* POST /password-reset
* GET /users
* GET /users/:id
* POST /users/:id/avatar
* POST /users/:id/password
* POST /users
```
{
}
```
* DELETE /users/:id
## Catalog photos
* GET /catalogs
* GET /catalogs/rando
* GET /catalogs/:id
* GET /catalogs/:id/photos
*
------
# New contribution system
### File
@EmbeddedDocument
name: string
mimeType: string
originalFileName: string
size: int
hash: string
### Resolution
@EmbeddedDocument
slug: 'sm'|'md'|'original'
/*name: @Virtual(match slug with
| 'sm' => 'Small'
| 'md' => 'Medium'
| 'xl' => 'Extra large',
| 'original' => 'Original'
)*/
width: int
height: int
file: @EmbedOne(File)
### Catalog
@Collection
name: string
description: string
parent: @ReferenceOne(Catalog)
children: @ReferenceMany(Catalog)
isPublic: bool # définit si le catalogue peut être vu par des guests (ex: A trier)
primaryPicture: @ReferenceOne(Picture)
createdAt: datetime
updatedAt: datetime
### Picture
@Collection
resolutions: @EmbedMany(Resolution)
validatedVersion: @ReferenceOne(Version)
versions: @ReferenceMany(Version)
updatedAt: datetime
isPublished: boolean (default false)
isDeleted: boolean
deletedAt: datetime
createdAt: datetime
### HistoricalDateTime
@EmbeddedDocument
precision: string 'year'|'month'|'day'|'hour'|'minute'|'second'
from: datetime
to: datetime
### PictureVersion implement Version
@Collection
picture: @ReferenceOne(Picture)
changes: @ReferenceMany(ChangeVersion)
(redondant) makers: @ReferenceMany(User) # users that contributed to this version
beforeVersion: ?@ReferenceOne(PictureVersion)
catalog: @ReferenceOne(Catalog)
name: string, # ou id_agency
description: ?string,
source: string,
place: ?@ReferenceOne(Place),
position: ?@EmbedOne(Position),
takenAt: ?@EmbedOne(HistoricalDateTime),
exif: @EmbedOne(Exif) {
model: string,
manufacturer: string,
aperture: string,
iso: int,
exposure: string,
focalLength: float,
flash: bool
...
}
license: @EmbedOne(License) {
name: Can be one of: [
null,
'CC BY',
'CC BY-SA',
'CC BY-ND',
'CC BY-NC',
'CC BY-NC-SA',
'CC BY-NC-ND',
'CC BY-SA 3.0 IGO',
'All rights reserved'
'Public Domain'
]
isModified: boolean (default: false)
}
### Change
@Collection
status: 'pending'|'rejected'|'accepted'
field: string (path to the proprety)
oldValue: mixed
newValue: mixed
moderatorComment: ?string
moderatedBy: @ReferenceOne(Use)
moderatedAt: datetime
createdBy: @ReferenceOne(User)
createdAt: datetime
### ChangePicture extends Change
object: @ReferenceOne(Picture)
basedOn: ?@ReferenceOne(PictureVersion)
### ChangeCatalog extends Change
object: @ReferenceOne(Catalog)
basedOn: ?@ReferenceOne(CatalogVersion)
-------
PANEL MODO
- Image 1
- [x] Change from user #A2 for field name, value "New name"
- [x] Change from user #A1 for field description, value "Wow"
- Create version
- Image 2
- Field: name
- ( ) Change from user #A1 for field name, value "WoW2"
- ( ) Change from user #A2 for field name, value "WOW"
- Field: description
- ( ) Change from user #A1 for field name, description "WOW"
- Create version