Technical¶
Components¶
hemnet consists of the following components:
- Data structure (existing + new tables and fields) in Lime CRM
- Python package
- Commands and Web components for web client usage
- Actionpad app for desktop client usage
Table and Field Definitions Lime CRM¶
Table mapped to Hemnet's project¶
| db name | Field type | Comment |
|---|---|---|
| hemnet_id | string (length 32) | Readonly |
| hemnet_status | option | Readonly, see options below. |
| hemnet_error | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
| hemneturl | link (length 128) | Readonly |
| pictures | relation (hasmany) | Real Estate standard pictures table |
Table mapped to Hemnet's projectunit¶
This part is related to the publishing of projectunit
| db name | Field type | Comment |
|---|---|---|
| hemnet_id_project | string (length 32) | Readonly |
| hemnet_status_project | option | Readonly, see options below. |
| hemnet_error_project | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
| hemnet_status_featured | option | Readonly, see options below. |
| hemnet_error_featured | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
| hemneturl_project | link (length 128) | Readonly |
| middle_picture | relation (hasmany) | Real Estate standard middle_picture table |
Table mapped to Hemnet's listing¶
!!!note Publishing of listings is not supported in the current version. The listing fields below are optional.
This part is related to the publishing of listing
Can be the same table as the table that is mapped to projectunit.
| db name | Field type | Comment |
|---|---|---|
| hemnet_id_listing | string (length 32) | Readonly |
| hemnet_status_listing | option | Readonly, see options below. |
| hemnet_error_listing | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
| hemneturl_listing | link (length 128) | Readonly |
| middle_picture | relation (hasmany) | Real Estate standard middle_picture table |
Table mapped to Hemnet's showing related to projectunit¶
| db name | Field type | Comment |
|---|---|---|
| hemnet_id_unit | string (length 32) | Readonly |
| hemnet_status_projectunit | option | Readonly, see options below. |
| hemnet_error_projectunit | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
Table mapped to Hemnet's showing related to listing¶
| db name | Field type | Comment |
|---|---|---|
| hemnet_id_listing | string (length 32) | Readonly |
| hemnet_status_listing | option | Readonly, see options below. |
| hemnet_error_listing | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
Additional fields needed on pictures¶
| db name | Field type | Comment |
|---|---|---|
| publishon | set | The option key hemnet needs to be added |
| hemnet_id | string (length 32) | Readonly Hidden |
| hemnet_status | option | Readonly, see options below. |
| hemnet_error | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
Additional fields needed on middle_picture¶
| db name | Field type | Comment |
|---|---|---|
| publishon | set | The option key hemnet needs to be added |
| hemnet_id_projectunit | string (length 32) | Readonly Hidden |
| hemnet_status_projectunit | option | Readonly, see options below. |
| hemnet_error_projectunit | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
| hemnet_id_listing | string (length 32) | Readonly Hidden |
| hemnet_status_listing | option | Readonly, see options below. |
| hemnet_error_listing | string (length 256) | Readonly. Populated with error message if hemnet_status is error_publish or error_unpublish. |
Hemnet Status Options¶
| Key | Description |
|---|---|
empty |
|
published |
The object is published to Hemnet. |
unpublished |
The object has been unpublished from Hemnet. |
error_publish |
Something went wrong while publishing. |
error_unpublish |
Something went wront while unpublishing. |
For hemnet_status_featured, published means that the project unit is featured on Hemnet. When the unit is removed as featured, the status is set to empty.
Other requirements on tables and relations¶
- The tables for images must be named
picturesandmiddle_picture. They are not configured inhemnet_mapping. picturesneeds a file fieldpictureand an integer fieldorder.orderis sent to Hemnet as the image order, and changing it updates the image on Hemnet.middle_pictureneeds an integer fieldorderand a relationpicturesto thepicturestable. The image sent to Hemnet is the related picture.- Relations used by the integration (pictures → project, middle_picture → project unit, project unit → project, showing → project unit) must have the same name as the related limetype configured in
hemnet_mapping.limetables.
Python package¶
Endpoints¶
All endpoints have the prefix /limepkg-hemnet.
| Endpoint | Method | Used by | Description |
|---|---|---|---|
/task/hemnet/publish-project/ |
POST | bulk-publish-units |
Publishes the project (if needed) and the given project units. |
/task/hemnet/publish-project-only/ |
POST | publish-project |
Publishes the project and its images, without project units. |
/task/hemnet/unpublish-project/ |
POST | unpublish-project |
Unpublishes the project. |
/task/hemnet/unpublish-unit/ |
POST | unpublish-unit |
Unpublishes a project unit. |
/task/hemnet/publish-featureunits/ |
POST | publish-feature-units |
Sets project units as featured. |
/task/hemnet/unpublish-featureunits/ |
POST | unpublish-feature-units |
Removes project units as featured. |
/hemnet-config/ |
GET | Web client commands | Returns hemnet_mapping from the application config. |
/projectunits-publish-warning/, /showings-publish-warning/, /images-publish-warning/ |
GET | Warning web components | Return the number of related objects with an error status. |
/hemnet/picture/ |
GET | Hemnet | Public. Runs as apiuser@hemnet and returns the file in pictures.picture. |
/hemnet/project/, /hemnet/unit/, /hemnet/project/featureunits/ |
POST/DELETE | Desktop client (Actionpad app) | Same tasks as above. |
The task endpoints start background tasks, so publishing is asynchronous.
Hemnet downloads the images from {server_dns}/{application name}/limepkg-hemnet/hemnet/picture/?pictureid=<id>, so server_dns must be reachable from the internet.
Commands¶
Publish project¶
limepkg_hemnet.publish-project
This action publishes an already created or updated project to Hemnet without upserting related project units. Useful when you want to publish/update a project independently of its project units.
The action will: - Create the project on Hemnet if it hasn't been published yet - Update the project on Hemnet if it already exists - Upsert related images marked for publishing to Hemnet - Publish the project without triggering upsert of project units
Available to use as custom action (on the project).
Publish project units¶
limepkg_hemnet.bulk-publish-units
This action publishes all selected project units, will also publish the project if it is not already published. Avalaible to use as bulk action in the list of project units on the project card (the command needs the project as parent).
Set project units as featured¶
limepkg_hemnet.publish-feature-units
This action will set all selected project units as featured on Hemnet. To be able to set a project unit as featured, the project unit must be published to Hemnet. The command therefore checks that all selected project units are published to Hemnet.
Hemnet has a limit of 5 featured project units for a project, this action therefore checks that there are not more than 5 project units selected (together with already featured project units).
Showings are only published to Hemnet for featured project units. Setting a project unit as featured also publishes its showings, and new showings on a featured unit are published automatically.
Avalaible to use as bulk action and custom action (on the project unit).
Remove project units as featured¶
limepkg_hemnet.unpublish-feature-units
This action will remove all selected project units as featured on Hemnet. Their published showings are removed from Hemnet. Avalaible to use as bulk action and custom action (on the project unit).
Unpublish project¶
limepkg_hemnet.unpublish-project
This action will unpublish the project on Hemnet. Related project units and images are set as unpublished in Lime. The status of showings and the featured status of project units are not updated. Avalaible to use as custom action (on the project).
Unpublish project unit¶
limepkg_hemnet.unpublish-unit
This action will unpublish the project unit together with all related images and showings. Related showings are unpublished before the project unit itself. This is because Hemnet delays unpublishing a unit by 7 days if it still has future showings. The same applies when a published project unit is deleted. A featured project unit is also removed as featured. Avalaible to use as custom action (on the project unit).
Web components¶
| Component | Purpose |
|---|---|
lwc-limepkg-hemnet-projectunits-publish-warning |
For the project card. Shows a warning if any related project unit has hemnet_status_project = error_publish or error_unpublish. |
lwc-limepkg-hemnet-showings-publish-warning |
For the project card. Shows a warning if any showing of the project's units has hemnet_status_projectunit = error_publish or error_unpublish. |
lwc-limepkg-hemnet-images-publish-warning |
For the project card. Shows a warning if any image related to the project or its project units failed to be published/unpublished. |
The warning components have no configuration and are hidden when there are no errors. See configuration for how to add them.