build: add TypeScript configuration and generate declaration files
- Add tsconfig.json for TypeScript compilation with declaration and source map generation - Generate .d.ts declaration files for all modules, services, controllers, and models - Update package.json with NestJS dependencies and TypeScript development tools - Include database files in the distribution output for persistence
This commit is contained in:
13
dist/foods/foods.controller.d.ts
vendored
Normal file
13
dist/foods/foods.controller.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { FoodsService } from './foods.service';
|
||||
export declare class FoodsController {
|
||||
private foodsService;
|
||||
constructor(foodsService: FoodsService);
|
||||
getFoods(req: any, category: string, q: string): Promise<{
|
||||
filipino_foods: import("../models/food-item.model").FoodItem[];
|
||||
other_foods: import("../models/food-item.model").FoodItem[];
|
||||
categories: string[];
|
||||
current_category: string;
|
||||
search_query: string;
|
||||
user: any;
|
||||
}>;
|
||||
}
|
||||
58
dist/foods/foods.controller.js
vendored
Normal file
58
dist/foods/foods.controller.js
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FoodsController = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const authenticated_guard_1 = require("../auth/guards/authenticated.guard");
|
||||
const foods_service_1 = require("./foods.service");
|
||||
let FoodsController = class FoodsController {
|
||||
constructor(foodsService) {
|
||||
this.foodsService = foodsService;
|
||||
}
|
||||
async getFoods(req, category, q) {
|
||||
try {
|
||||
const data = await this.foodsService.getFoods(category, q);
|
||||
return Object.assign({ user: req.user }, data);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
req.flash('error_msg', 'Error loading foods');
|
||||
return {
|
||||
user: req.user,
|
||||
filipino_foods: [],
|
||||
other_foods: [],
|
||||
categories: [],
|
||||
current_category: 'all',
|
||||
search_query: '',
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.FoodsController = FoodsController;
|
||||
__decorate([
|
||||
(0, common_1.Get)(),
|
||||
(0, common_1.Render)('foods'),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__param(1, (0, common_1.Query)('category')),
|
||||
__param(2, (0, common_1.Query)('q')),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object, String, String]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], FoodsController.prototype, "getFoods", null);
|
||||
exports.FoodsController = FoodsController = __decorate([
|
||||
(0, common_1.Controller)('foods'),
|
||||
(0, common_1.UseGuards)(authenticated_guard_1.AuthenticatedGuard),
|
||||
__metadata("design:paramtypes", [foods_service_1.FoodsService])
|
||||
], FoodsController);
|
||||
//# sourceMappingURL=foods.controller.js.map
|
||||
1
dist/foods/foods.controller.js.map
vendored
Normal file
1
dist/foods/foods.controller.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"foods.controller.js","sourceRoot":"","sources":["../../src/foods/foods.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAgF;AAChF,4EAAwE;AACxE,mDAA+C;AAIxC,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAI5C,AAAN,KAAK,CAAC,QAAQ,CAAQ,GAAG,EAAqB,QAAgB,EAAc,CAAS;QACnF,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC3D,uBACE,IAAI,EAAE,GAAG,CAAC,IAAI,IACX,IAAI,EACP;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;YAC9C,OAAO;gBACL,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,cAAc,EAAE,EAAE;gBAClB,WAAW,EAAE,EAAE;gBACf,UAAU,EAAE,EAAE;gBACd,gBAAgB,EAAE,KAAK;gBACvB,YAAY,EAAE,EAAE;aACjB,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAzBY,0CAAe;AAKpB;IAFL,IAAA,YAAG,GAAE;IACL,IAAA,eAAM,EAAC,OAAO,CAAC;IACA,WAAA,IAAA,YAAG,GAAE,CAAA;IAAO,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IAAoB,WAAA,IAAA,cAAK,EAAC,GAAG,CAAC,CAAA;;;;+CAmB1E;0BAxBU,eAAe;IAF3B,IAAA,mBAAU,EAAC,OAAO,CAAC;IACnB,IAAA,kBAAS,EAAC,wCAAkB,CAAC;qCAEM,4BAAY;GADnC,eAAe,CAyB3B"}
|
||||
2
dist/foods/foods.module.d.ts
vendored
Normal file
2
dist/foods/foods.module.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare class FoodsModule {
|
||||
}
|
||||
25
dist/foods/foods.module.js
vendored
Normal file
25
dist/foods/foods.module.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FoodsModule = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const sequelize_1 = require("@nestjs/sequelize");
|
||||
const foods_controller_1 = require("./foods.controller");
|
||||
const foods_service_1 = require("./foods.service");
|
||||
const food_item_model_1 = require("../models/food-item.model");
|
||||
let FoodsModule = class FoodsModule {
|
||||
};
|
||||
exports.FoodsModule = FoodsModule;
|
||||
exports.FoodsModule = FoodsModule = __decorate([
|
||||
(0, common_1.Module)({
|
||||
imports: [sequelize_1.SequelizeModule.forFeature([food_item_model_1.FoodItem])],
|
||||
controllers: [foods_controller_1.FoodsController],
|
||||
providers: [foods_service_1.FoodsService],
|
||||
})
|
||||
], FoodsModule);
|
||||
//# sourceMappingURL=foods.module.js.map
|
||||
1
dist/foods/foods.module.js.map
vendored
Normal file
1
dist/foods/foods.module.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"foods.module.js","sourceRoot":"","sources":["../../src/foods/foods.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAAoD;AACpD,yDAAqD;AACrD,mDAA+C;AAC/C,+DAAqD;AAO9C,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IALvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,2BAAe,CAAC,UAAU,CAAC,CAAC,0BAAQ,CAAC,CAAC,CAAC;QACjD,WAAW,EAAE,CAAC,kCAAe,CAAC;QAC9B,SAAS,EAAE,CAAC,4BAAY,CAAC;KAC1B,CAAC;GACW,WAAW,CAAG"}
|
||||
12
dist/foods/foods.service.d.ts
vendored
Normal file
12
dist/foods/foods.service.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { FoodItem } from '../models/food-item.model';
|
||||
export declare class FoodsService {
|
||||
private foodItemModel;
|
||||
constructor(foodItemModel: typeof FoodItem);
|
||||
getFoods(category?: string, searchQuery?: string): Promise<{
|
||||
filipino_foods: FoodItem[];
|
||||
other_foods: FoodItem[];
|
||||
categories: string[];
|
||||
current_category: string;
|
||||
search_query: string;
|
||||
}>;
|
||||
}
|
||||
62
dist/foods/foods.service.js
vendored
Normal file
62
dist/foods/foods.service.js
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FoodsService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const sequelize_1 = require("@nestjs/sequelize");
|
||||
const sequelize_2 = require("sequelize");
|
||||
const food_item_model_1 = require("../models/food-item.model");
|
||||
let FoodsService = class FoodsService {
|
||||
constructor(foodItemModel) {
|
||||
this.foodItemModel = foodItemModel;
|
||||
}
|
||||
async getFoods(category = 'all', searchQuery = '') {
|
||||
const whereClause = {};
|
||||
if (category !== 'all') {
|
||||
whereClause.category = category;
|
||||
}
|
||||
if (searchQuery) {
|
||||
whereClause[sequelize_2.Op.or] = [
|
||||
{ name: { [sequelize_2.Op.like]: `%${searchQuery}%` } },
|
||||
{ name_tagalog: { [sequelize_2.Op.like]: `%${searchQuery}%` } },
|
||||
];
|
||||
}
|
||||
const filipinoWhere = Object.assign(Object.assign({}, whereClause), { is_filipino: true });
|
||||
const otherWhere = Object.assign(Object.assign({}, whereClause), { is_filipino: false });
|
||||
const filipinoFoods = await this.foodItemModel.findAll({
|
||||
where: filipinoWhere,
|
||||
order: [['name', 'ASC']],
|
||||
});
|
||||
const otherFoods = await this.foodItemModel.findAll({
|
||||
where: otherWhere,
|
||||
limit: 20,
|
||||
order: [['name', 'ASC']],
|
||||
});
|
||||
const categories = ['all', 'kanin', 'ulam', 'sabaw', 'gulay', 'meryenda', 'almusal'];
|
||||
return {
|
||||
filipino_foods: filipinoFoods,
|
||||
other_foods: otherFoods,
|
||||
categories,
|
||||
current_category: category,
|
||||
search_query: searchQuery,
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.FoodsService = FoodsService;
|
||||
exports.FoodsService = FoodsService = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__param(0, (0, sequelize_1.InjectModel)(food_item_model_1.FoodItem)),
|
||||
__metadata("design:paramtypes", [Object])
|
||||
], FoodsService);
|
||||
//# sourceMappingURL=foods.service.js.map
|
||||
1
dist/foods/foods.service.js.map
vendored
Normal file
1
dist/foods/foods.service.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"foods.service.js","sourceRoot":"","sources":["../../src/foods/foods.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,yCAA+B;AAC/B,+DAAqD;AAG9C,IAAM,YAAY,GAA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