Skip to content

Commit

Permalink
Updated filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratikshakhandagale committed Jul 12, 2024
1 parent 2a8e39c commit b319375
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/app/pages/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class HomePage implements OnInit, OnTabViewWillEnter, OnDestroy {
this.showSheenAnimation = true;
// try {
let lang = await this.storage.getData('lang')
let content = await this.configService.getAllContent(req, lang, this.configVariables.defaultContentFilter.key, this.configVariables.defaultContentFilter.value);
let content = await this.configService.getAllContent(req, lang);
this.mappUIContentList(content);
// }
// catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/bot-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export class BotApiService {
language: lang,
text: text,
audio: "",
context: this.domainConfig['sub-domain'] + '_' + botType
context: botType
}
} else if (audio !== "") {
req.input = {
language: lang,
audio: audio,
text: "",
context: this.domainConfig['sub-domain'] + '_' + botType
context: botType
}
}

Expand Down
22 changes: 16 additions & 6 deletions src/app/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ import { config } from 'configuration/environment.prod';
import { ApiService } from './api/api.service';
import { ApiHttpRequestType, ApiRequest } from './api/model/api.request';
import { catchError, lastValueFrom, map } from 'rxjs';
import { ConfigVariables } from "../config";

@Injectable({
providedIn: 'root'
})
export class ConfigService {
configVariables : any;

constructor(private apiService: ApiService) { }
constructor(private apiService: ApiService) {
ConfigVariables.then(config => {
console.log('Configuration:', config);
this.configVariables = config;
// Use the config data as needed
}).catch(error => {
console.error('Failed to load configuration:', error);
});
}

async getConfigMeta(): Promise<Config> {
const apiRequest = new ApiRequest.Builder()
Expand All @@ -29,17 +39,17 @@ export class ConfigService {
})
}

async getAllContent(req: any, lang: any, defaultContentFilterKey: any, defaultContentFilterValue: any): Promise<any> {
async getAllContent(req: any, lang: any): Promise<any> {
let requestBody = {
language: lang,
request: {
orderBy: {
"mimetype": "video/x-youtube"
},
filters: {
[defaultContentFilterKey] : defaultContentFilterValue
},
fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]
filters:
this.configVariables.defaultContentFilter[0]
,
// fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]

}
}
Expand Down
22 changes: 18 additions & 4 deletions src/app/services/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ import { config } from 'configuration/environment.prod';
import { ApiService } from './api/api.service';
import { ApiHttpRequestType, ApiRequest } from './api/model/api.request';
import { ApiResponse } from './api/model/api.response';
import { ConfigVariables } from "../config";

@Injectable({
providedIn: 'root'
})
export class SearchService {
configVariables: any;

constructor(
private apiService: ApiService
) { }
) {
ConfigVariables.then(config => {
console.log('Configuration:', config);
this.configVariables = config;
// Use the config data as needed
}).catch(error => {
console.error('Failed to load configuration:', error);
});
}

async postSearchContext(data: any, audio: boolean): Promise<any> {
let requestBody = {};
Expand All @@ -24,7 +34,8 @@ export class SearchService {
orderBy: {
"mimetype": "video/x-youtube"
},
fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]
filters: this.configVariables.defaultContentFilter[0]
// fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]

}
}
Expand All @@ -36,7 +47,8 @@ export class SearchService {
orderBy: {
"mimetype": "video/x-youtube"
},
fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]
filters: this.configVariables.defaultContentFilter[0]
// fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]
}
}
}
Expand Down Expand Up @@ -69,7 +81,9 @@ export class SearchService {
orderBy: {
"mimetype": "video/x-youtube"
},
fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]
filters: this.configVariables.defaultContentFilter[0]

// fields: ["mimetype", "identifier","keywords","name", "thumbnail", "media", "agegroup", "language", "sourceorg", "url", "domain", "category"]

}
}
Expand Down
6 changes: 2 additions & 4 deletions src/assets/appConfig/localhost.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
"splashImage": "assets/school/GEMS.jpeg",
"sub-domain": "dharmalife",
"defaultContentFilter": [{
"agegroup": "3-6",
"sourseorg": ["ABC"]
}
],
"agegroup": ["3-6", "6-8"]
}],
"headerFilters": [
{
"defaultFilter": {
Expand Down

0 comments on commit b319375

Please sign in to comment.