Skip to content

Conversation

b1ff
Copy link
Contributor

@b1ff b1ff commented Mar 25, 2022

No description provided.

export async function up(knex: Knex): Promise<void> {
return knex.schema.createTable(tables.templatesLocalized, table => {
table.string('templateName', 50).notNullable().references('templates.name').onDelete('CASCADE');
table.text('content').notNullable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

table.text('content', 'mediumtext').notNullable();

Copy link
Contributor Author

@b1ff b1ff Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what means 'mediumtext'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found answer here knex/knex#1064 (comment)
Updated type

@@ -0,0 +1,4 @@
export const tables = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the purpose of this file is enumeration of existing tables ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap, in order not to write string literal every time when table name is needed

export interface LocalizedTemplate {
templateName: string;
content: string;
locale?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if locale is absent I would expect default one.
how to configure default locale ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default locale is specified on content column of the template table

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you are right it should be required


const validateRequestBeforeCreateTemplate = validateRequestFactory([{
schema: templateSchema,
selector: 'body',
}]);

const createTemplate = async (req: Request, res: Response): Promise<void> => {
const template = req.body;
const request = req.body;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template looked like more as an entity the request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't get this one

@@ -43,6 +43,7 @@ describe('ErrorHandler', () => {
});

const response = await server.get('/_ilc/500').expect(500);
console.log(response.text);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it expected to be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

Copy link
Contributor Author

@b1ff b1ff Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@b1ff b1ff merged commit 3c3aa22 into master Mar 30, 2022
@b1ff b1ff deleted the feature/multi-lang-template branch March 30, 2022 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants