mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	fix: antennas validation (#11469)
This commit is contained in:
		
							parent
							
								
									49fc4cce3c
								
							
						
					
					
						commit
						f664f941a2
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -85,8 +85,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
			
		|||
		private globalEventService: GlobalEventService,
 | 
			
		||||
	) {
 | 
			
		||||
		super(meta, paramDef, async (ps, me) => {
 | 
			
		||||
			if ((ps.keywords.length === 0) || ps.keywords[0].every(x => x === '')) {
 | 
			
		||||
				throw new Error('invalid param');
 | 
			
		||||
			if (ps.keywords.flat().every(x => x === '') && ps.excludeKeywords.flat().every(x => x === '')) {
 | 
			
		||||
				throw new Error('either keywords or excludeKeywords is required.');
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			const currentAntennasCount = await this.antennasRepository.countBy({
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,6 +82,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
			
		|||
		private globalEventService: GlobalEventService,
 | 
			
		||||
	) {
 | 
			
		||||
		super(meta, paramDef, async (ps, me) => {
 | 
			
		||||
			if (ps.keywords.flat().every(x => x === '') && ps.excludeKeywords.flat().every(x => x === '')) {
 | 
			
		||||
				throw new Error('either keywords or excludeKeywords is required.');
 | 
			
		||||
			}
 | 
			
		||||
			// Fetch the antenna
 | 
			
		||||
			const antenna = await this.antennasRepository.findOneBy({
 | 
			
		||||
				id: ps.antennaId,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue