Documentation comment not found for method definition
findById
54
55 }
56
57 static async findById({id}){58 const clientFound = await prisma.client.findFirst({
59 where:{
60 id
Documentation comment not found for method definition
findMany
48 })
49 }
50
51 static async findMany(){52
53 return prisma.client.findMany({clientInclude})
54
Documentation comment not found for method definition
create
28
29class ClientModel {
30
31 static async create({username, email, password, address}) {32 return prisma.client.create({
33 data:{
34 username,
Documentation comment not found for class
ClientModel
26 }
27}
28
29class ClientModel {30
31 static async create({username, email, password, address}) {
32 return prisma.client.create({
Documentation comment not found for class
TestController
2import Controller from "./controller.js";
3const entity = new TestEntity()
4
5class TestController extends Controller{ 6 constructor(){
7 super(entity)
8 }
Documentation comment not found for method definition
validate
10 super(SellerModel)
11 }
12
13 async validate(req, res){ 14
15 const seller = await this.findById(req)
16 const sellerKey = await Validator.createAuthToken({...seller, isSeller: true}, process.env.SELLER_TOKEN_KEY) //mismo caso que con el salesManager
Documentation comment not found for class
SellerController
4
5const SellerModel = new Seller();
6
7class SellerController extends Controller{ 8
9 constructor(){
10 super(SellerModel)
Documentation comment not found for method definition
validate
10 super(ManagerModel)
11 }
12
13 async validate(req, res){ 14
15 const manager = await this.findById(req)
16 const managerKey = await Validator.createAuthToken({...manager, isSeller: true}, process.env.MANAGER_TOKEN_KEY) //como no tengo el archivo env voy a inventar el nombre del token
Documentation comment not found for class
SalesManagerController
4
5const ManagerModel = new SalesManager();
6
7class SalesManagerController extends Controller{ 8
9 constructor(){
10 super(ManagerModel)
Documentation comment not found for method definition
validate
27 }
28 }
29
30 static async validate(req, res){31
32 }
33}
Documentation comment not found for method definition
deleteProduct
18 }
19 }
20
21 static async deleteProduct(req, res){22 try {
23 const product = await productModel.delete(req.params.id)
24 }
Documentation comment not found for method definition
postProducts
8 super(ProductController, productModel)
9 }
10
11 static async postProducts(req, res){12 try {
13 const {username, category, stock, price, description} = req.body
14 await productModel.create(username, category, stock, price, description)
Documentation comment not found for class
ProductController
2import Controller from './controller.js'
3const productModel = new Product()
4
5class ProductController extends Controller{ 6
7 constructor(){
8 super(ProductController, productModel)
Documentation comment not found for method definition
validate
46 }
47 }
48
49 static async validate(req, res){50
51 }
52
Documentation comment not found for method definition
deleteOrder
37 }
38 }
39
40 static async deleteOrder(req, res){41 try {
42 const order = await orderModel.delete(req.params.id)
43 }
Documentation comment not found for method definition
checkOrder
27 }
28 }
29
30 static async checkOrder(req, res){31 try {
32 const order = await orderModel.findOne(req.params.id)
33
Documentation comment not found for method definition
downloadOrder
17 }
18 }
19
20 static async downloadOrder(req, res){21 try {
22 const order = await orderModel.findOne(req.params.id)
23
Documentation comment not found for method definition
postOrders
7 super(orderController, orderModel)
8 }
9
10 static async postOrders(req, res){11 try {
12 const {date, state, totalPrice, check, paymentMethod} = req.body
13 await orderModel.create(date, state, totalPrice, check, paymentMethod)
Documentation comment not found for class
orderController
2import Controller from './controller.js'
3const orderModel = new Order()
4
5class orderController extends Controller { 6 constructor() {
7 super(orderController, orderModel)
8 }
Documentation comment not found for method definition
update
47 return data
48 }
49
50 async update(req, res){51 try{
52 await this.model.update(req.params.id, req.body)
53 return res.json({ msg: `Se ha actualizado el ${Object.getPrototypeOf(this)} exitosamente` })
Documentation comment not found for method definition
find
30 // }
31 }
32
33 async find(offset = 0){34 const data = await this.model.findMany(offset)
35
36 return data
Documentation comment not found for method definition
create
16 }
17
18
19 async create(req){20
21 const entity = await this.model.create(req.body)
22 return entity
Documentation comment not found for method definition
validate
91 return res.json(client)
92 }
93
94 static async validate(req, res){ 95
96 const client = await this.findById(req)
97 const clientKey = await Validator.createAuthToken({id: client.id, name: client.name}, process.env.CLIENT_TOKEN_KEY)
Documentation comment not found for method definition
view
86 */
87 }
88
89 static async view(req, res){ 90
91 return res.json(client)
92 }
Description
It is recommended to have documentation comments above, or right inside a function/class declaration. This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skipdoccoverage option under the analyzers.meta
property in your .deepsource.toml
file.
For example, the following configuration will silence this issue for class expressions and method definitions:
[analyzers.meta]
skip_doc_coverage = ["class-expression", "method-definition"]
Bad Practice
function sum(a, b) {
return a + b;
}
Recommended
/**
* Function to add two numbers
* @param a The first number to add
* @param b The second number to add
* @returns The sum of two numbers
*/
function sum(a, b) {
return a + b;
}