This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Attempt to create the alias | |
| aliases.create(new_alias) | |
| .then (alias) -> | |
| # The .success method outputs JSON and calls res.end() | |
| res._cc.success(alias) | |
| return | |
| .catch () -> | |
| # Alias must not currently exist | |
| aliases.findOne().where({ src_name: new_alias.src_name }) | |
| .then (alias) -> |