Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
impr
Browse files Browse the repository at this point in the history
  • Loading branch information
norbornen committed Sep 11, 2019
1 parent 5993ac6 commit 6ec297a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@types/ejs": "^2.6.3",
"@types/mongoose": "^5.5.17",
"@types/node": "^12.7.4",
"@types/node": "^12.7.5",
"@types/qs": "^6.5.3",
"@types/ramda": "^0.26.21",
"axios": "^0.19.0",
Expand Down
4 changes: 2 additions & 2 deletions src/models/Offer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ abstract class Offer extends CommonModel {
public is_notifications_send?: boolean;
}


const oddAddressPartRegexp = /(Россия|г\.?\s?Москва|Москва),\s*/g;
@pre<FlatOffer>(/^findOneAndUpdate/, function() {
const location = path<FlatOfferLocation>(['_update', 'location'], this);
if (location && 'address' in location && location.address) {
location.short_address = location.address.replace(/(Россия|Москва),\s*/g, '').replace(/,\s?,/g, ',');
location.short_address = location.address.replace(oddAddressPartRegexp, '').replace(/,\s?,/g, ',');
}
})
@index({ source: 1, ext_id: 1 }, { unique: true })
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@
"@types/mongodb" "*"
"@types/node" "*"

"@types/node@*", "@types/node@^12.0.4", "@types/node@^12.7.4":
"@types/node@*", "@types/node@^12.0.4":
version "12.7.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.4.tgz#64db61e0359eb5a8d99b55e05c729f130a678b04"
integrity sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ==

"@types/node@^12.7.5":
version "12.7.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.5.tgz#e19436e7f8e9b4601005d73673b6dc4784ffcc2f"
integrity sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==

"@types/node@^8.0.7":
version "8.10.53"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.53.tgz#5fa08eef810b08b2c03073e360b54f7bad899db1"
Expand Down

0 comments on commit 6ec297a

Please sign in to comment.