mirror of
https://github.com/hexastack/hexabot
synced 2024-11-28 06:52:20 +00:00
Merge pull request #210 from Hexastack/209-issue-attachment-spelling-issue
fix: attachment spelling issue
This commit is contained in:
commit
15eee175d2
@ -63,7 +63,7 @@ async function mongoMigrationConnection() {
|
|||||||
|
|
||||||
async function getModels() {
|
async function getModels() {
|
||||||
await mongoMigrationConnection();
|
await mongoMigrationConnection();
|
||||||
const AttachementModel = mongoose.model<Attachment>(
|
const AttachmentModel = mongoose.model<Attachment>(
|
||||||
Attachment.name,
|
Attachment.name,
|
||||||
attachmentSchema,
|
attachmentSchema,
|
||||||
);
|
);
|
||||||
@ -117,7 +117,7 @@ async function getModels() {
|
|||||||
const UserModel = mongoose.model<User>(User.name, userSchema);
|
const UserModel = mongoose.model<User>(User.name, userSchema);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
AttachementModel,
|
AttachmentModel,
|
||||||
BlockModel,
|
BlockModel,
|
||||||
BotstatsModel,
|
BotstatsModel,
|
||||||
ContentModel,
|
ContentModel,
|
||||||
|
@ -73,8 +73,8 @@ export class AttachmentController extends BaseController<Attachment> {
|
|||||||
async findOne(@Param('id') id: string): Promise<Attachment> {
|
async findOne(@Param('id') id: string): Promise<Attachment> {
|
||||||
const doc = await this.attachmentService.findOne(id);
|
const doc = await this.attachmentService.findOne(id);
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
this.logger.warn(`Unable to find Attachement by id ${id}`);
|
this.logger.warn(`Unable to find Attachment by id ${id}`);
|
||||||
throw new NotFoundException(`Attachement with ID ${id} not found`);
|
throw new NotFoundException(`Attachment with ID ${id} not found`);
|
||||||
}
|
}
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ export const ContentImportDialog: FC<ContentImportDialogProps> = ({
|
|||||||
closeDialog,
|
closeDialog,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const [attachmentId, setAttachementId] = useState<string | null>(null);
|
const [attachmentId, setAttachmentId] = useState<string | null>(null);
|
||||||
const { t } = useTranslate();
|
const { t } = useTranslate();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const { apiClient } = useApiClient();
|
const { apiClient } = useApiClient();
|
||||||
@ -58,7 +58,7 @@ export const ContentImportDialog: FC<ContentImportDialogProps> = ({
|
|||||||
);
|
);
|
||||||
const handleCloseDialog = () => {
|
const handleCloseDialog = () => {
|
||||||
closeDialog();
|
closeDialog();
|
||||||
setAttachementId(null);
|
setAttachmentId(null);
|
||||||
};
|
};
|
||||||
const handleImportClick = () => {
|
const handleImportClick = () => {
|
||||||
if (attachmentId && data?.contentType?.id) {
|
if (attachmentId && data?.contentType?.id) {
|
||||||
@ -76,7 +76,7 @@ export const ContentImportDialog: FC<ContentImportDialogProps> = ({
|
|||||||
format="basic"
|
format="basic"
|
||||||
accept="text/csv"
|
accept="text/csv"
|
||||||
onChange={(id, _) => {
|
onChange={(id, _) => {
|
||||||
setAttachementId(id);
|
setAttachmentId(id);
|
||||||
}}
|
}}
|
||||||
label=""
|
label=""
|
||||||
value={attachmentId}
|
value={attachmentId}
|
||||||
|
@ -29,7 +29,7 @@ export const NlpImportDialog: FC<NlpImportDialogProps> = ({
|
|||||||
closeDialog,
|
closeDialog,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const [attachmentId, setAttachementId] = useState<string | null>(null);
|
const [attachmentId, setAttachmentId] = useState<string | null>(null);
|
||||||
const { t } = useTranslate();
|
const { t } = useTranslate();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
@ -63,7 +63,7 @@ export const NlpImportDialog: FC<NlpImportDialogProps> = ({
|
|||||||
);
|
);
|
||||||
const handleCloseDialog = () => {
|
const handleCloseDialog = () => {
|
||||||
closeDialog();
|
closeDialog();
|
||||||
setAttachementId(null);
|
setAttachmentId(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -76,7 +76,7 @@ export const NlpImportDialog: FC<NlpImportDialogProps> = ({
|
|||||||
format="basic"
|
format="basic"
|
||||||
accept="text/csv"
|
accept="text/csv"
|
||||||
onChange={(id, _) => {
|
onChange={(id, _) => {
|
||||||
setAttachementId(id);
|
setAttachmentId(id);
|
||||||
}}
|
}}
|
||||||
label=""
|
label=""
|
||||||
value={attachmentId}
|
value={attachmentId}
|
||||||
|
@ -24,7 +24,7 @@ export const MessageForm = () => {
|
|||||||
{/* TEXT BLOCK */}
|
{/* TEXT BLOCK */}
|
||||||
{Array.isArray(block?.message) ? <TextMessageForm /> : null}
|
{Array.isArray(block?.message) ? <TextMessageForm /> : null}
|
||||||
|
|
||||||
{/* ATTACHEMENT BLOCK */}
|
{/* ATTACHMENT BLOCK */}
|
||||||
{block?.message && "attachment" in block?.message ? (
|
{block?.message && "attachment" in block?.message ? (
|
||||||
<AttachmentMessageForm />
|
<AttachmentMessageForm />
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -200,19 +200,19 @@ export class ApiClient {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async importNlpSamples(attachementId: string) {
|
async importNlpSamples(attachmentId: string) {
|
||||||
const { _csrf } = await this.getCsrf();
|
const { _csrf } = await this.getCsrf();
|
||||||
const { data } = await this.request.post(
|
const { data } = await this.request.post(
|
||||||
`${ROUTES.NLP_SAMPLE_IMPORT}/${attachementId}`,
|
`${ROUTES.NLP_SAMPLE_IMPORT}/${attachmentId}`,
|
||||||
{ _csrf },
|
{ _csrf },
|
||||||
);
|
);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async importContent(contentTypeId: string, attachementId: string) {
|
async importContent(contentTypeId: string, attachmentId: string) {
|
||||||
const { data } = await this.request.get(
|
const { data } = await this.request.get(
|
||||||
`${ROUTES.CONTENT_IMPORT}/${contentTypeId}/${attachementId}`,
|
`${ROUTES.CONTENT_IMPORT}/${contentTypeId}/${attachmentId}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -38,7 +38,7 @@ export enum FileType {
|
|||||||
unknown = "unknown",
|
unknown = "unknown",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachements
|
// Attachments
|
||||||
export interface AttachmentAttrs {
|
export interface AttachmentAttrs {
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user