Merge branch 'main' of https://github.com/vi117/Ionian
This commit is contained in:
		
						commit
						b6ac7e171b
					
				
					 2 changed files with 22 additions and 6 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -8,6 +8,7 @@ data/**
 | 
				
			||||||
data/
 | 
					data/
 | 
				
			||||||
package-lock.json
 | 
					package-lock.json
 | 
				
			||||||
devdb.sqlite3
 | 
					devdb.sqlite3
 | 
				
			||||||
 | 
					db.sqlite3
 | 
				
			||||||
build/**
 | 
					build/**
 | 
				
			||||||
app/**
 | 
					app/**
 | 
				
			||||||
settings.json
 | 
					settings.json
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,16 +29,31 @@ const ContentTagIDHandler = (controller: DocumentAccessor) => async (ctx: Contex
 | 
				
			||||||
    ctx.type = 'json';
 | 
					    ctx.type = 'json';
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
const ContentQueryHandler = (controller : DocumentAccessor) => async (ctx: Context,next: Next)=>{
 | 
					const ContentQueryHandler = (controller : DocumentAccessor) => async (ctx: Context,next: Next)=>{
 | 
				
			||||||
    const limit = ParseQueryNumber(ctx.query['limit']);
 | 
					
 | 
				
			||||||
    const cursor = ParseQueryNumber(ctx.query['cursor']);
 | 
					    let query_limit = (ctx.query['limit']);
 | 
				
			||||||
    const word = ParseQueryArgString(ctx.query['word']);
 | 
					    let query_cursor = (ctx.query['cursor']);
 | 
				
			||||||
    const content_type = ParseQueryArgString(ctx.query['content_type']);
 | 
					    let query_word = (ctx.query['word']);
 | 
				
			||||||
    const offset = ParseQueryNumber(ctx.query['offset']);
 | 
					    let query_content_type = (ctx.query['content_type']);
 | 
				
			||||||
 | 
					    let query_offset = (ctx.query['offset']);
 | 
				
			||||||
 | 
					    let query_use_offset = ctx.query['use_offset'];
 | 
				
			||||||
 | 
					    if(query_limit instanceof Array 
 | 
				
			||||||
 | 
					        || query_cursor instanceof Array 
 | 
				
			||||||
 | 
					        || query_word instanceof Array 
 | 
				
			||||||
 | 
					        || query_content_type instanceof Array
 | 
				
			||||||
 | 
					        || query_offset instanceof Array
 | 
				
			||||||
 | 
					        || query_use_offset instanceof Array){
 | 
				
			||||||
 | 
					        return sendError(400,"paramter can not be array");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const limit = ParseQueryNumber(query_limit);
 | 
				
			||||||
 | 
					    const cursor = ParseQueryNumber(query_cursor);
 | 
				
			||||||
 | 
					    const word = ParseQueryArgString(query_word);
 | 
				
			||||||
 | 
					    const content_type = ParseQueryArgString(query_content_type);
 | 
				
			||||||
 | 
					    const offset = ParseQueryNumber(query_offset);
 | 
				
			||||||
    if(limit === NaN || cursor === NaN || offset === NaN){
 | 
					    if(limit === NaN || cursor === NaN || offset === NaN){
 | 
				
			||||||
        return sendError(400,"parameter limit, cursor or offset is not a number");
 | 
					        return sendError(400,"parameter limit, cursor or offset is not a number");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const allow_tag = ParseQueryArray(ctx.query['allow_tag']);
 | 
					    const allow_tag = ParseQueryArray(ctx.query['allow_tag']);
 | 
				
			||||||
    const [ok,use_offset] = ParseQueryBoolean(ctx.query['use_offset']);
 | 
					    const [ok,use_offset] = ParseQueryBoolean(query_use_offset);
 | 
				
			||||||
    if(!ok){
 | 
					    if(!ok){
 | 
				
			||||||
        return sendError(400,"use_offset must be true or false.");
 | 
					        return sendError(400,"use_offset must be true or false.");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue