Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix english-language error messages in example #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions conduit/services/users.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ module.exports = {
if (entity.username) {
const found = await this.adapter.findOne({ username: entity.username });
if (found)
throw new MoleculerClientError("Username is exist!", 422, "", [{ field: "username", message: "is exist" }]);
throw new MoleculerClientError("Username exists!", 422, "", [{ field: "username", message: "already exists" }]);
}

if (entity.email) {
const found = await this.adapter.findOne({ email: entity.email });
if (found)
throw new MoleculerClientError("Email is exist!", 422, "", [{ field: "email", message: "is exist" }]);
throw new MoleculerClientError("Email exists!", 422, "", [{ field: "email", message: "already exists" }]);
}

entity.password = bcrypt.hashSync(entity.password, 10);
Expand Down Expand Up @@ -199,13 +199,13 @@ module.exports = {
if (newData.username) {
const found = await this.adapter.findOne({ username: newData.username });
if (found && found._id.toString() !== ctx.meta.user._id.toString())
throw new MoleculerClientError("Username is exist!", 422, "", [{ field: "username", message: "is exist" }]);
throw new MoleculerClientError("Username exists!", 422, "", [{ field: "username", message: "already exists" }]);
}

if (newData.email) {
const found = await this.adapter.findOne({ email: newData.email });
if (found && found._id.toString() !== ctx.meta.user._id.toString())
throw new MoleculerClientError("Email is exist!", 422, "", [{ field: "email", message: "is exist" }]);
throw new MoleculerClientError("Email exists!", 422, "", [{ field: "email", message: "already exists" }]);
}
newData.updatedAt = new Date();
const update = {
Expand Down