mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
[CORL 133] API Review (#2197)
* refactor: removed unused subscription code
* refactor: removed management api's
* refactor: cleanup of connections
* refactor: refactored comments edge
* refactor: simplified connection resolving
* feat: added story connection edge
* fix: added story index
* feat: added user pagination and user edge
* fix: added filter to comment query
* fix: removed unused resolvers
* fix: creating a comment reply should require auth
* refactor: cleanup of graph files
* feat: removed display name, made username non-unique
* fix: fixed tests
* fix: fixed tests
* fix: added more api docs
* fix: fixed bug with installer
* refactor: fixes and updates
* fix: added linting for graphql, fixed schema
* feat: added docker build tests
* fix: upped output timeout
* fix: fixed stacktraces in production builds
* fix: removed `git add`
- `git add` was causing issues with
partial staged changs on files
* feat: improved error messaging for auth
* refactor: cleaned up queue names
* fix: merge error
This commit is contained in:
@@ -250,15 +250,6 @@ export class DuplicateStoryURLError extends TalkError {
|
||||
}
|
||||
}
|
||||
|
||||
export class DuplicateUsernameError extends TalkError {
|
||||
constructor(username: string) {
|
||||
super({
|
||||
code: ERROR_CODES.DUPLICATE_USERNAME,
|
||||
context: { pvt: { username } },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DuplicateEmailError extends TalkError {
|
||||
constructor(email: string) {
|
||||
super({ code: ERROR_CODES.DUPLICATE_EMAIL, context: { pvt: { email } } });
|
||||
@@ -313,15 +304,6 @@ export class UsernameTooShortError extends TalkError {
|
||||
}
|
||||
}
|
||||
|
||||
export class DisplayNameExceedsMaxLengthError extends TalkError {
|
||||
constructor(length: number, max: number) {
|
||||
super({
|
||||
code: ERROR_CODES.DISPLAY_NAME_EXCEEDS_MAX_LENGTH,
|
||||
context: { pub: { length, max } },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class PasswordTooShortError extends TalkError {
|
||||
constructor(length: number, min: number) {
|
||||
super({
|
||||
@@ -378,6 +360,21 @@ export class UserNotFoundError extends TalkError {
|
||||
}
|
||||
}
|
||||
|
||||
export class StoryNotFoundError extends TalkError {
|
||||
constructor(storyID: string) {
|
||||
super({ code: ERROR_CODES.STORY_NOT_FOUND, context: { pvt: { storyID } } });
|
||||
}
|
||||
}
|
||||
|
||||
export class CommentNotFoundError extends TalkError {
|
||||
constructor(commentID: string) {
|
||||
super({
|
||||
code: ERROR_CODES.COMMENT_NOT_FOUND,
|
||||
context: { pvt: { commentID } },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class TenantNotFoundError extends TalkError {
|
||||
constructor(hostname: string) {
|
||||
super({
|
||||
@@ -413,3 +410,13 @@ export class TenantInstalledAlreadyError extends TalkError {
|
||||
super({ code: ERROR_CODES.TENANT_INSTALLED_ALREADY, status: 400 });
|
||||
}
|
||||
}
|
||||
|
||||
export class AuthenticationError extends TalkError {
|
||||
constructor(reason: string) {
|
||||
super({
|
||||
code: ERROR_CODES.AUTHENTICATION_ERROR,
|
||||
status: 401,
|
||||
context: { pvt: { reason } },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
import { ERROR_CODES } from "talk-common/errors";
|
||||
|
||||
export const ERROR_TRANSLATIONS: Record<ERROR_CODES, string> = {
|
||||
COMMENTING_DISABLED: "error-commentingDisabled",
|
||||
STORY_CLOSED: "error-storyClosed",
|
||||
COMMENT_BODY_TOO_SHORT: "error-commentBodyTooShort",
|
||||
COMMENT_BODY_EXCEEDS_MAX_LENGTH: "error-commentBodyExceedsMaxLength",
|
||||
STORY_URL_NOT_PERMITTED: "error-storyURLNotPermitted",
|
||||
TOKEN_NOT_FOUND: "error-tokenNotFound",
|
||||
DUPLICATE_STORY_URL: "error-duplicateStoryURL",
|
||||
EMAIL_ALREADY_SET: "error-emailAlreadySet",
|
||||
EMAIL_NOT_SET: "error-emailNotSet",
|
||||
TENANT_NOT_FOUND: "error-tenantNotFound",
|
||||
DUPLICATE_USER: "error-duplicateUser",
|
||||
DUPLICATE_USERNAME: "error-duplicateUsername",
|
||||
COMMENT_BODY_TOO_SHORT: "error-commentBodyTooShort",
|
||||
COMMENT_NOT_FOUND: "error-commentNotFound",
|
||||
COMMENTING_DISABLED: "error-commentingDisabled",
|
||||
DUPLICATE_EMAIL: "error-duplicateEmail",
|
||||
DUPLICATE_STORY_URL: "error-duplicateStoryURL",
|
||||
DUPLICATE_USER: "error-duplicateUser",
|
||||
EMAIL_ALREADY_SET: "error-emailAlreadySet",
|
||||
EMAIL_EXCEEDS_MAX_LENGTH: "error-emailExceedsMaxLength",
|
||||
EMAIL_INVALID_FORMAT: "error-emailInvalidFormat",
|
||||
EMAIL_NOT_SET: "error-emailNotSet",
|
||||
INTERNAL_ERROR: "error-internalError",
|
||||
LOCAL_PROFILE_ALREADY_SET: "error-localProfileAlreadySet",
|
||||
LOCAL_PROFILE_NOT_SET: "error-localProfileNotSet",
|
||||
NOT_FOUND: "error-notFound",
|
||||
PASSWORD_TOO_SHORT: "error-passwordTooShort",
|
||||
STORY_CLOSED: "error-storyClosed",
|
||||
STORY_NOT_FOUND: "error-storyNotFound",
|
||||
STORY_URL_NOT_PERMITTED: "error-storyURLNotPermitted",
|
||||
TENANT_INSTALLED_ALREADY: "error-tenantInstalledAlready",
|
||||
TENANT_NOT_FOUND: "error-tenantNotFound",
|
||||
TOKEN_INVALID: "error-tokenInvalid",
|
||||
TOKEN_NOT_FOUND: "error-tokenNotFound",
|
||||
USER_NOT_ENTITLED: "error-userNotEntitled",
|
||||
USER_NOT_FOUND: "error-userNotFound",
|
||||
USERNAME_ALREADY_SET: "error-usernameAlreadySet",
|
||||
USERNAME_CONTAINS_INVALID_CHARACTERS:
|
||||
"error-usernameContainsInvalidCharacters",
|
||||
USERNAME_EXCEEDS_MAX_LENGTH: "error-usernameExceedsMaxLength",
|
||||
USERNAME_TOO_SHORT: "error-usernameTooShort",
|
||||
PASSWORD_TOO_SHORT: "error-passwordTooShort",
|
||||
DISPLAY_NAME_EXCEEDS_MAX_LENGTH: "error-displayNameExceedsMaxLength",
|
||||
EMAIL_INVALID_FORMAT: "error-emailInvalidFormat",
|
||||
EMAIL_EXCEEDS_MAX_LENGTH: "error-emailExceedsMaxLength",
|
||||
USER_NOT_FOUND: "error-userNotFound",
|
||||
NOT_FOUND: "error-notFound",
|
||||
INTERNAL_ERROR: "error-internalError",
|
||||
TOKEN_INVALID: "error-tokenInvalid",
|
||||
TENANT_INSTALLED_ALREADY: "error-tenantInstalledAlready",
|
||||
USER_NOT_ENTITLED: "error-userNotEntitled",
|
||||
AUTHENTICATION_ERROR: "error-authenticationError",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user