fix: lesson duration field updating

This commit is contained in:
Sergey Yarkov 2022-06-02 22:44:12 +03:00
parent 5a01acdb21
commit ffdebc4f92
4 changed files with 10 additions and 22 deletions

View File

@ -144,12 +144,13 @@ export default class LessonRepository {
if (lesson) { if (lesson) {
/** /**
* Update files * Update fields
*/ */
lesson.merge({ lesson.merge({
title: data.title, title: data.title,
description: data.description, description: data.description,
course_id: data.course_id, course_id: data.course_id,
...(data.duration && { duration: data.duration.toFormat('HH:mm:ss') }),
}); });
/** /**

View File

@ -11,7 +11,7 @@ export default class CreateCourseValidator {
education_description: schema.string.nullable(), education_description: schema.string.nullable(),
image: schema.file.optional({ image: schema.file.optional({
size: '10mb', size: '10mb',
extnames: ['jpg', 'jpeg', 'png'], extnames: ['jpg', 'jpeg', 'png', 'webp'],
}), }),
teacher_id: schema.string({}, [rules.exists({ table: 'users', column: 'id' })]), teacher_id: schema.string({}, [rules.exists({ table: 'users', column: 'id' })]),
category_id: schema.string({}, [rules.exists({ table: 'categories', column: 'id' })]), category_id: schema.string({}, [rules.exists({ table: 'categories', column: 'id' })]),

View File

@ -10,7 +10,7 @@ export default class UpdateCourseValidator {
education_description: schema.string.nullable(), education_description: schema.string.nullable(),
image: schema.file.optional({ image: schema.file.optional({
size: '10mb', size: '10mb',
extnames: ['jpg', 'jpeg', 'png'], extnames: ['jpg', 'jpeg', 'png', 'webp'],
}), }),
teacher_id: schema.string.optional({}, [rules.exists({ table: 'users', column: 'id' })]), teacher_id: schema.string.optional({}, [rules.exists({ table: 'users', column: 'id' })]),
category_id: schema.string.optional({}, [rules.exists({ table: 'categories', column: 'id' })]), category_id: schema.string.optional({}, [rules.exists({ table: 'categories', column: 'id' })]),

View File

@ -1,30 +1,17 @@
{ {
"extends": "./node_modules/adonis-preset-ts/tsconfig", "extends": "./node_modules/adonis-preset-ts/tsconfig",
"include": [ "include": ["**/*"],
"**/*" "exclude": ["node_modules", "build"],
],
"exclude": [
"node_modules",
"build"
],
"compilerOptions": { "compilerOptions": {
"outDir": "build", "outDir": "build",
"rootDir": "./", "rootDir": "./",
"sourceMap": true, "sourceMap": true,
"useDefineForClassFields": true, "useDefineForClassFields": true,
"paths": { "paths": {
"App/*": [ "App/*": ["./app/*"],
"./app/*" "Config/*": ["./config/*"],
], "Contracts/*": ["./contracts/*"],
"Config/*": [ "Database/*": ["./database/*"]
"./config/*"
],
"Contracts/*": [
"./contracts/*"
],
"Database/*": [
"./database/*"
]
}, },
"types": [ "types": [
"@adonisjs/core", "@adonisjs/core",