0.16.85 • Published 1 year ago

@leoantares/phiv-core v0.16.85

Weekly downloads
7
License
MIT
Repository
-
Last release
1 year 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

1 year ago

0.16.83

1 year ago

0.16.84

1 year ago

0.16.79

1 year ago

0.16.80

1 year ago

0.16.81

1 year ago

0.16.82

1 year ago

0.17.22

2 years ago

0.16.78

2 years ago

0.16.77

2 years ago

0.17.19

2 years ago

0.17.21

2 years ago

0.17.20

2 years ago

0.16.76

2 years ago

0.16.74

2 years ago

0.16.75

2 years ago

0.16.72

2 years ago

0.16.73

2 years ago

0.16.70

2 years ago

0.16.71

2 years ago

0.17.9

2 years ago

0.17.10

2 years ago

0.17.12

2 years ago

0.17.11

2 years ago

0.17.14

2 years ago

0.17.13

2 years ago

0.17.16

2 years ago

0.17.15

2 years ago

0.17.18

2 years ago

0.17.17

2 years ago

0.16.58

2 years ago

0.16.59

2 years ago

0.16.56

2 years ago

0.16.57

2 years ago

0.16.65

2 years ago

0.16.66

2 years ago

0.16.63

2 years ago

0.16.64

2 years ago

0.16.69

2 years ago

0.16.67

2 years ago

0.16.68

2 years ago

0.16.61

2 years ago

0.16.62

2 years ago

0.16.60

2 years ago

0.17.7

2 years ago

0.17.8

2 years ago

0.16.54

2 years ago

0.16.55

2 years ago

0.16.52

2 years ago

0.16.53

2 years ago

0.17.6

3 years ago

0.16.43

3 years ago

0.16.44

3 years ago

0.16.47

2 years ago

0.16.48

2 years ago

0.16.45

3 years ago

0.16.46

3 years ago

0.16.49

2 years ago

0.16.50

2 years ago

0.16.51

2 years ago

0.16.38

3 years ago

0.16.39

3 years ago

0.16.41

3 years ago

0.16.42

3 years ago

0.16.40

3 years ago

0.16.32

3 years ago

0.16.33

3 years ago

0.16.31

3 years ago

0.16.36

3 years ago

0.16.37

3 years ago

0.16.34

3 years ago

0.16.35

3 years ago

0.17.2

3 years ago

0.17.3

3 years ago

0.17.4

3 years ago

0.17.5

3 years ago

0.17.0

3 years ago

0.17.1

3 years ago

0.16.30

3 years ago

0.16.29

3 years ago

0.16.28

3 years ago

0.16.27

3 years ago

0.16.22

4 years ago

0.16.25

3 years ago

0.16.26

3 years ago

0.16.23

3 years ago

0.16.24

3 years ago

0.16.10

4 years ago

0.16.14

4 years ago

0.16.15

4 years ago

0.16.12

4 years ago

0.16.13

4 years ago

0.16.3

4 years ago

0.16.4

4 years ago

0.16.5

4 years ago

0.16.6

4 years ago

0.16.7

4 years ago

0.16.8

4 years ago

0.16.9

4 years ago

0.16.19

4 years ago

0.16.16

4 years ago

0.16.17

4 years ago

0.16.0

4 years ago

0.16.1

4 years ago

0.16.21

4 years ago

0.16.20

4 years ago

0.15.31

4 years ago

0.15.32

4 years ago

0.15.29

4 years ago

0.15.30

4 years ago

0.15.28

4 years ago

0.15.27

4 years ago

0.15.24

4 years ago

0.15.23

5 years ago

0.15.22

5 years ago

0.15.21

5 years ago

0.15.20

5 years ago

0.15.19

5 years ago

0.15.18

5 years ago

0.15.13

5 years ago

0.15.13-0

5 years ago

0.15.12

5 years ago

0.15.10

5 years ago

0.15.9

5 years ago

0.15.8

5 years ago

0.15.7

6 years ago

0.15.6

6 years ago

0.15.5

6 years ago

0.15.4

6 years ago

0.15.3

6 years ago

0.15.2

6 years ago

0.15.1

6 years ago

0.15.0

6 years ago

0.14.0

6 years ago

0.13.0

6 years ago

0.12.12

6 years ago

0.12.11

6 years ago

0.12.10

6 years ago

0.12.9

6 years ago

0.12.8

6 years ago

0.12.7

6 years ago

0.12.6

6 years ago

0.12.5

6 years ago

0.12.4

6 years ago

0.12.3

6 years ago

0.12.2

6 years ago

0.12.1

6 years ago

0.11.7

6 years ago

0.12.0

6 years ago

0.11.6

6 years ago

0.11.5

6 years ago

0.11.4

6 years ago

0.11.3

6 years ago

0.11.2

6 years ago

0.11.1

6 years ago

0.11.0

6 years ago

0.10.8

6 years ago

0.10.7

6 years ago

0.10.6

6 years ago

0.10.5

6 years ago

0.10.4

7 years ago

0.10.3

7 years ago

0.10.2

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.27

7 years ago

0.9.26

7 years ago

0.9.25

7 years ago

0.9.24

7 years ago

0.9.23

7 years ago

0.9.22

7 years ago

0.9.21

7 years ago

0.9.20

7 years ago

0.9.19

7 years ago

0.9.18

7 years ago

0.9.17

7 years ago

0.9.16

7 years ago

0.9.15

7 years ago

0.9.14

7 years ago

0.9.13

7 years ago

0.9.12

7 years ago

0.9.11

7 years ago

0.9.10

7 years ago

0.9.9

7 years ago

0.9.8

7 years ago

0.9.7

7 years ago

0.9.6

7 years ago

0.9.5

7 years ago

0.9.4

7 years ago

0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.13

7 years ago

0.8.12

7 years ago

0.8.11

7 years ago

0.8.10

7 years ago

0.8.9

7 years ago

0.8.8

7 years ago

0.8.7

7 years ago

0.8.6

7 years ago

0.8.5

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.14

7 years ago

0.7.13

7 years ago

0.7.12

7 years ago

0.7.11

7 years ago

0.7.10

7 years ago

0.7.9

7 years ago

0.7.8

7 years ago

0.7.7

7 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.4

7 years ago

0.7.3

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.12

7 years ago

0.3.11

7 years ago

0.3.10

7 years ago

0.3.9

7 years ago

0.3.8

7 years ago

0.3.7

7 years ago

0.3.6

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago