UGRAM Team 10 Shared Models
Voir sur npmjs.com
Utilisation du package
Installation
Le package peut être installé par la commande suivante :
npm i ugram-team-10-shared
Utilisation
En TypeScript, on peut importer les modèles du package de cette manière :
import { UploadPicturePayload } from "ugram-team-10-shared";
Publication du package
Numéro de version
Afin de publier le package, il faut d'abord s'assurer d'avoir incrémenté la version dans le fichier shared/package.json. Le numéro de version respecte le format suivant : X.Y.Z
.
- Le numéro
X
ne sera probablement jamais incrémenté (sauf dans le cas d'une réécriture complète). - Le numéro
Y
doit être incrémenté si un changement non rétrocompatible est introduit dans le code source du package. Dans ce cas, le numéro Z
est réinitialisé à 0. - Le numéro
Z
doit être incrémenté seulement si les changements introduits dans le code source du package sont rétrocompatibles, par exemple la correction d'un bug mineur ou la mise à jour de la documentation.
Authentification
La commande npm whoami
permet de déterminer quel utilisateur est connecté actuellement sur le poste source.
Si l'utilisateur n'est pas ugram, il faut se connecter avec la commande npm login
et répondre aux questions dans l'invite de commande. L'authentification à deux facteurs (2FA) étant activée, il faudra contacter Francis Pion afin de déverrouiller l'accès.
On peut également se déconnecter avec la commande npm logout
.
Publication
Afin de publier le package, il faut d'abord construire les sources, puis on peut ensuite publier le package. Les commandes suivantes doivent être exécutées.
npm run build
npm publish --access public
Enumerations
Notification Enumerations
NotificationType
: used to represent the different notification types.PictureSizeType
: used to represent the different picture size types.
Payloads
Chat Payloads
SendMessagePayload
: used to send a message in a chat room.
CreateCommentPayload
: used to post an user comment on a picture.
Picture Payloads
UpdatePicturePayload
: used to update an existing picture.UploadPicturePayload
: used to upload a new picture.
User Payloads
AuthenticateGooglePayload
: used to authenticate an user with Google.SaveProfilePayload
: used to edit an user's profile.SignInPayload
: used to sign in an user.SignUpPayload
: used to create a new user.
View Models
Chat View Models
ConversationList
: used to represent a paged conversation list.ConversationViewModel
: used to represent a chat room.MessageList
: used to represent a paged message list.MessageViewModel
: used to represent a message in a chat room.
CommentViewModel
: used to represent an user comment posted on a picture.
Notification View Models
NotificationList
: used to represent a paged notification list.NotificationViewModel
: used to represent a notification.
Picture View Models
KeywordList
: used to represent a paged keyword list.KeywordViewModel
: used to create a keyword-selector (dropdown) or any other control providing information about keywords and the number of pictures associated.PictureList
: used to represent a paged picture list.PictureSizeViewModel
: used to provide information about a typed picture size, such as its dimensions and location.PictureViewModel
: used to provide fully-fledged information about a picture.
User View Models
AuthenticateGoogleViewModel
: used to indicate whether or not an user has been authenticated with Google.AuthenticationTokenViewModel
: used to represent an authentication token.UserList
: used to represent a paged user list.UserSummary
: used to construct a nice & clean user list.UserViewModel
: used to provide fully-fledged information about an user.