0.16.85 • Published 2 months ago

@leoantares/phiv-core v0.16.85

Weekly downloads
7
License
MIT
Repository
-
Last release
2 months ago

Pharmactiv code package

This package intend to publish common code regarding the Pharmactiv projets


Apis

To use an API simply instanciate it const apiCategory = new ApiCategory(config).

The Configuration object:

interface IConfiguration {
  baseURL: string;
  headers: Object;
  timeout: number;
}
const configuration: IConfiguration = {
  baseURL: "https://www.api.com",
  fileMaxSize: 15000000,
  headers: {},
  timeout: 60000
};

Constants

The exported variable API_CONSTANTS exposes the following set of constants: ACCOUNTS, DISCOUNTS, HIGHLIGHTS, PAGES.

Assistance

List of endpoints: get, getById, post, patch, delete.

Category

List of endpoints: get, getPostsById, getByType, post, patch, positionByType, delete.

Drugstore

interface IDrugstoreSearch {
    nw: string<lat, lng>;
    se: string<lat, lng>;
    assistances: string<uuid>[];
    specializations: string<uuid>[];
}

List of endpoints: get, getBy, getById, search(query: IDrugstoreSearch, config?: IConfiguration), register(), patch.

Drugstore Membership

List of endpoints: get, getById, patch.

File

List of endpoints: upload(isMultiple: boolean, isBase64: boolean), getFile.

const query = {
    url: '<file_url>',
}

const { data } = await apiFile.getFile(query);

Highlight

List of endpoints: get(contextType?: string, contextId?: string, config?: IConfiguration), getById, getByType(type: integer, contextType?: string, contextId?: string, config?: IConfiguration), getByTypeWithQuery, post, patch, delete.

If necessary, you can send queries from Frontend to filter results like example below :

Method getByTypeWithQuery :

const query = { 
    env: '<env>' // Integer - Available values : API_CONSTANTS.PHREF_ENVS (For now env parameter works only with Highlight's type API_CONSTANTS.HIGHLIGHTS.HOMEPAGE_CATALOG)
};

const { data } = await apiHighlight.getByTypeWithQuery(
    '<highlight_type>', // Integer - Available values : API_CONSTANTS.HIGHLIGHTS.HOMEPAGE_CATALOG
    query
);

Highlightable

List of endpoints: patch, delete.

Page

List of endpoints: get, post, patch, delete.

Partoo

List of endpoints: auth, businesses, organizations, users, categories.

Patient

List of endpoints: version, verify, login, register, resendCode, requestResetPassword, resetPassword, me, verifyPhone, verifyPinCode, patch, patchLink, patchPassword, patchPinCode, delete, adelyaGet, adelyaPut, adelyaDelete, epsilonGet, epsilonPut, epsilonDelete, apiCoreGet, apiCorePost, apiCorePatch, apiCorePut, apiCoreDelete, linkGet, linkPost, linkPatch, linkPut, linkDelete.

Pharmanity

List of endpoints: categories, ranges.

Post

List of endpoints: get, getById, getBySlug, post, patch, delete.

If necessary, you can send queries from Frontend to filter results like example below :

const query = {
    categories: '<category_id>,<category_id>,...', // uuid,uuid,...
    level_id: '<level_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    min_date: '<min_date>', // Y-m-d H:i:s
    max_date: '<max_date>', // Y-m-d H:i:s
    search: '<search>', // String
}

const { data } = await apiPost.get(query);

Product

List of endpoints: get, getById, getByCategoryId(categoryId: integer, type: string<(medi|para)>, page?: integer, pharmanityId?: string, config?: IConfiguration), getPostsById, getStock, post, patch, delete.

Search

The endpoint is apiSearch.get(model: string, query: string, type?: number, config?: IConfiguration).

Models: product, drugstore, post.

Service

List of endpoints: get, getById, post, patch, delete.

Specialisation

List of endpoints: get, getById, post, patch, delete.

Universe

List of endpoints: get, getBySlug, post, patch, delete.

Popin

List of endpoints: get, post, delete.

Level

List of endpoints: get, getById, post, patch, delete.

Pack

List of endpoints: get, getById, post, patch, delete.

Zone

List of endpoints: get, getById, post, patch, delete.

Right

List of endpoints: get, getById, post, patch, delete.

Help

List of endpoints: get, getById, post, patch, position, delete.

Event

List of endpoints: get, getById, exportCsv, post, patch, delete, search, searchAdmin.

If necessary, you can send queries from Frontend to filter results like example below :

Method get (GET method) :

const query = {
    category_id: '<category_id>', // uuid
    level_id: '<level_id>', // uuid
    zone_id: '<zone_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    min_date: '<min_date>', // Y-m-d H:i:s
    max_date: '<max_date>', // Y-m-d H:i:s
    group: '<group>', // Integer - Available values : API_CONSTANTS.PHREF_GROUPS
    drugstore_id: '<drugstore_id>', // uuid
}

const { data } = await apiEvent.get(query);

Method search (POST method) :

const query = {
    category_id: '<category_id>', // uuid
    level_id: '<level_id>', // uuid
    zone_id: '<zone_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    min_date: '<min_date>', // Y-m-d H:i:s
    max_date: '<max_date>', // Y-m-d H:i:s
    group: '<group>', // Integer - Available values : API_CONSTANTS.PHREF_GROUPS
    drugstore_id: '<drugstore_id>', // uuid
}

const { data } = await apiEvent.search(query);

Registration

List of endpoints: get, getById, getPositionsList, post, patch, delete.

Docutheque

List of endpoints: get, getAdmin, post, patch, delete.

If necessary, you can send queries from Frontend to filter results like example below :

const query = {
    category_id: '<category_id>', // uuid
    level_id: '<level_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    type: '<type>', // Integer
    search: '<search>', // String
}

const { data } = await apiDocument.get(query);

Advancedpage

List of endpoints: get, getByCategory, getBySlug, post, patch, positionByCategory, delete.

Warning

List of endpoints: get, getAdmin, post, patch, import, delete.

Mydata

List of endpoints: get, getAdmin, getMyData, post, patch, import, delete.

If necessary, you can send queries from Frontend to filter results like example below :

const query = {
    min_date: '<min_date>', // Y-m-d
    max_date: '<max_date>', // Y-m-d
}

const { data } = await apiMydata.get(query);
const query = {
    history: '<bool>',
}

const { data } = await apiMydata.getMyData(
    '<mydata_id>', // uuid
    '<cip>', // String
    '<type>', // String - Available types values inside record returned by apiMydata.get()
    query
);

TransactionType (Opérations BRI)

List of endpoints: get, getAdmin, getByCategoryId, post, patch, delete.

User

interface ILog {
    email: string;
    password: string;
}

interface IResetPassword {
    password: string;
    confirmation_password: string;
    token: string;
}

List of User endpoints: login(logs: ILog, config?: IConfiguration), loginAsAdmin(logs: ILog, config?: IConfiguration), register(), registerPharmacist(), getById, post, patch, sendResetPasswordToken(email: string, config?: IConfiguration), resetPassword(data: IResetPassword, config?: IConfiguration), logout().

List of Account endpoints: logAccount(account: Account, config: IConfiguration), patchAccount.

List of Notifications endpoints: getUnreadNotifications, getReadNotifications, setNotificationAsRead.

apiUser.getUnreadNotifications(
    '<user_id>', // uuid
    '<type>', // String - Allowed values : 'post', 'document'
);
apiUser.getReadNotifications(
    '<user_id>', // uuid
    '<type>', // String - Allowed values : 'post', 'document'
);
apiUser.setNotificationAsRead(
    '<notification_id>', // uuid
);

Functions

Accounts

  • AccountsTypeLabel(type: integer)

Currency

  • FormatCurrency

Dates

  • DateFormat(date: Date, format: string)
  • DateFormatDistance(date1: Date, date2: Date)
  • DateFormatRelative(date1: Date, date2: Date)

For the moment, all dates are set in French.

Events

  • EventsDebounce(cb: Function): Function

Highlights

  • HighlightsFilter(highlights: Highlightable[], type: integer)
  • HighlightsFilterOne(highlights: Highlightable[], type: integer)
  • HihglightsGroup(Highlightable[])
  • HighlightsGetDiscountsLabel(discountType: integer)
  • HighlightsGetDiscountLabels(discountType: integer)
  • HighlightsGetPriceDescription(highlightable: IHighlightable)
  • HighlightsConvertCentsToEuro(price: string)

Notifications

interface INotification {
  content: string;
  timeout?: integer; // default 5000
}

List of notifications: custom, error, info, success.


How to publish on npm

  • Change package.json version and push it npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
  • npm publish --access public
0.16.85

2 months ago

0.16.83

3 months ago

0.16.84

3 months ago

0.16.79

3 months ago

0.16.80

3 months ago

0.16.81

3 months ago

0.16.82

3 months ago

0.17.22

9 months ago

0.16.78

9 months ago

0.16.77

11 months ago

0.17.19

1 year ago

0.17.21

12 months ago

0.17.20

12 months ago

0.16.76

11 months ago

0.16.74

12 months ago

0.16.75

11 months ago

0.16.72

12 months ago

0.16.73

12 months ago

0.16.70

1 year ago

0.16.71

1 year ago

0.17.9

1 year ago

0.17.10

1 year ago

0.17.12

1 year ago

0.17.11

1 year ago

0.17.14

1 year ago

0.17.13

1 year ago

0.17.16

1 year ago

0.17.15

1 year ago

0.17.18

1 year ago

0.17.17

1 year ago

0.16.58

1 year ago

0.16.59

1 year ago

0.16.56

1 year ago

0.16.57

1 year ago

0.16.65

1 year ago

0.16.66

1 year ago

0.16.63

1 year ago

0.16.64

1 year ago

0.16.69

1 year ago

0.16.67

1 year ago

0.16.68

1 year ago

0.16.61

1 year ago

0.16.62

1 year ago

0.16.60

1 year ago

0.17.7

1 year ago

0.17.8

1 year ago

0.16.54

1 year ago

0.16.55

1 year ago

0.16.52

1 year ago

0.16.53

1 year ago

0.17.6

1 year ago

0.16.43

1 year ago

0.16.44

1 year ago

0.16.47

1 year ago

0.16.48

1 year ago

0.16.45

1 year ago

0.16.46

1 year ago

0.16.49

1 year ago

0.16.50

1 year ago

0.16.51

1 year ago

0.16.38

2 years ago

0.16.39

2 years ago

0.16.41

2 years ago

0.16.42

2 years ago

0.16.40

2 years ago

0.16.32

2 years ago

0.16.33

2 years ago

0.16.31

2 years ago

0.16.36

2 years ago

0.16.37

2 years ago

0.16.34

2 years ago

0.16.35

2 years ago

0.17.2

2 years ago

0.17.3

2 years ago

0.17.4

2 years ago

0.17.5

2 years ago

0.17.0

2 years ago

0.17.1

2 years ago

0.16.30

2 years ago

0.16.29

2 years ago

0.16.28

2 years ago

0.16.27

2 years ago

0.16.22

2 years ago

0.16.25

2 years ago

0.16.26

2 years ago

0.16.23

2 years ago

0.16.24

2 years ago

0.16.10

2 years ago

0.16.14

2 years ago

0.16.15

2 years ago

0.16.12

2 years ago

0.16.13

2 years ago

0.16.3

3 years ago

0.16.4

3 years ago

0.16.5

2 years ago

0.16.6

2 years ago

0.16.7

2 years ago

0.16.8

2 years ago

0.16.9

2 years ago

0.16.19

2 years ago

0.16.16

2 years ago

0.16.17

2 years ago

0.16.0

3 years ago

0.16.1

3 years ago

0.16.21

2 years ago

0.16.20

2 years ago

0.15.31

3 years ago

0.15.32

3 years ago

0.15.29

3 years ago

0.15.30

3 years ago

0.15.28

3 years ago

0.15.27

3 years ago

0.15.24

3 years ago

0.15.23

3 years ago

0.15.22

3 years ago

0.15.21

3 years ago

0.15.20

3 years ago

0.15.19

3 years ago

0.15.18

3 years ago

0.15.13

4 years ago

0.15.13-0

4 years ago

0.15.12

4 years ago

0.15.10

4 years ago

0.15.9

4 years ago

0.15.8

4 years ago

0.15.7

5 years ago

0.15.6

5 years ago

0.15.5

5 years ago

0.15.4

5 years ago

0.15.3

5 years ago

0.15.2

5 years ago

0.15.1

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.12

5 years ago

0.12.11

5 years ago

0.12.10

5 years ago

0.12.9

5 years ago

0.12.8

5 years ago

0.12.7

5 years ago

0.12.6

5 years ago

0.12.5

5 years ago

0.12.4

5 years ago

0.12.3

5 years ago

0.12.2

5 years ago

0.12.1

5 years ago

0.11.7

5 years ago

0.12.0

5 years ago

0.11.6

5 years ago

0.11.5

5 years ago

0.11.4

5 years ago

0.11.3

5 years ago

0.11.2

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.8

5 years ago

0.10.7

5 years ago

0.10.6

5 years ago

0.10.5

5 years ago

0.10.4

5 years ago

0.10.3

5 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.27

5 years ago

0.9.26

5 years ago

0.9.25

5 years ago

0.9.24

5 years ago

0.9.23

5 years ago

0.9.22

5 years ago

0.9.21

5 years ago

0.9.20

5 years ago

0.9.19

5 years ago

0.9.18

5 years ago

0.9.17

5 years ago

0.9.16

5 years ago

0.9.15

5 years ago

0.9.14

5 years ago

0.9.13

5 years ago

0.9.12

5 years ago

0.9.11

5 years ago

0.9.10

5 years ago

0.9.9

5 years ago

0.9.8

5 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.13

6 years ago

0.8.12

6 years ago

0.8.11

6 years ago

0.8.10

6 years ago

0.8.9

6 years ago

0.8.8

6 years ago

0.8.7

6 years ago

0.8.6

6 years ago

0.8.5

6 years ago

0.8.4

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.14

6 years ago

0.7.13

6 years ago

0.7.12

6 years ago

0.7.11

6 years ago

0.7.10

6 years ago

0.7.9

6 years ago

0.7.8

6 years ago

0.7.7

6 years ago

0.7.6

6 years ago

0.7.5

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.6

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.12

6 years ago

0.3.11

6 years ago

0.3.10

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.13

6 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago