Skip to content

Commit c1ae32c

Browse files
feat: Implement core modules for partnership, inventory, and booking management, alongside user and veil repositories, and enhance veil management with image upload functionality.
1 parent cafecfd commit c1ae32c

16 files changed

Lines changed: 87 additions & 42 deletions

File tree

backend/src/booking/application/booking.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ export class BookingService {
2727
return booking;
2828
}
2929

30-
async update(id: string, updateBookingDto: UpdateBookingDto): Promise<Booking> {
30+
async update(
31+
id: string,
32+
updateBookingDto: UpdateBookingDto,
33+
): Promise<Booking> {
3134
const updated = await this.bookingRepository.update(id, updateBookingDto);
3235
if (!updated) {
3336
throw new Error(`Booking with ID ${id} not found`);

backend/src/booking/booking.module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { MongooseModule } from '@nestjs/mongoose';
33
import { BookingService } from './application/booking.service';
44
import { BookingController } from './presentation/booking.controller';
55
import { BookingRepository } from './infrastructure/repositories/booking.repository';
6-
import { BookingSchema, BookingSchemaEntity } from './infrastructure/schemas/booking.schema';
6+
import {
7+
BookingSchema,
8+
BookingSchemaEntity,
9+
} from './infrastructure/schemas/booking.schema';
710

811
@Module({
912
imports: [

backend/src/booking/infrastructure/repositories/booking.repository.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { Injectable } from '@nestjs/common';
22
import { InjectModel } from '@nestjs/mongoose';
33
import { Model } from 'mongoose';
44
import { Booking } from '../../domain/booking.entity';
5-
import { BookingDocument, BookingSchemaEntity } from '../schemas/booking.schema';
5+
import {
6+
BookingDocument,
7+
BookingSchemaEntity,
8+
} from '../schemas/booking.schema';
69

710
@Injectable()
811
export class BookingRepository {
@@ -16,7 +19,9 @@ export class BookingRepository {
1619
return docs.map((doc) => this.toDomain(doc));
1720
}
1821

19-
async create(booking: Omit<Booking, 'id' | 'createdAt' | 'updatedAt'>): Promise<Booking> {
22+
async create(
23+
booking: Omit<Booking, 'id' | 'createdAt' | 'updatedAt'>,
24+
): Promise<Booking> {
2025
const created = new this.bookingModel(booking);
2126
const doc = await created.save();
2227
return this.toDomain(doc);
@@ -30,7 +35,10 @@ export class BookingRepository {
3035
return doc ? this.toDomain(doc) : null;
3136
}
3237

33-
async update(id: string, updateData: Partial<Booking>): Promise<Booking | null> {
38+
async update(
39+
id: string,
40+
updateData: Partial<Booking>,
41+
): Promise<Booking | null> {
3442
const doc = await this.bookingModel
3543
.findByIdAndUpdate(id, { $set: updateData }, { new: true })
3644
.exec();
@@ -50,7 +58,7 @@ export class BookingRepository {
5058
d.date,
5159
d.status,
5260
d.createdAt,
53-
d.updatedAt
61+
d.updatedAt,
5462
);
5563
}
5664
}

backend/src/inventory/application/inventory.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ export class InventoryService {
2424
return inventory;
2525
}
2626

27-
async update(id: string, updateInventoryDto: UpdateInventoryDto): Promise<Inventory> {
28-
const updated = await this.inventoryRepository.update(id, updateInventoryDto);
27+
async update(
28+
id: string,
29+
updateInventoryDto: UpdateInventoryDto,
30+
): Promise<Inventory> {
31+
const updated = await this.inventoryRepository.update(
32+
id,
33+
updateInventoryDto,
34+
);
2935
if (!updated) {
3036
throw new Error(`Inventory item with ID ${id} not found`);
3137
}

backend/src/inventory/infrastructure/repositories/inventory.repository.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { Injectable } from '@nestjs/common';
22
import { InjectModel } from '@nestjs/mongoose';
33
import { Model } from 'mongoose';
44
import { Inventory } from '../../domain/inventory.entity';
5-
import { InventoryDocument, InventorySchemaEntity } from '../schemas/inventory.schema';
5+
import {
6+
InventoryDocument,
7+
InventorySchemaEntity,
8+
} from '../schemas/inventory.schema';
69

710
@Injectable()
811
export class InventoryRepository {
@@ -16,7 +19,9 @@ export class InventoryRepository {
1619
return docs.map((doc) => this.toDomain(doc));
1720
}
1821

19-
async create(inventory: Omit<Inventory, 'id' | 'lastUpdated'>): Promise<Inventory> {
22+
async create(
23+
inventory: Omit<Inventory, 'id' | 'lastUpdated'>,
24+
): Promise<Inventory> {
2025
const created = new this.inventoryModel(inventory);
2126
const doc = await created.save();
2227
return this.toDomain(doc);
@@ -30,7 +35,10 @@ export class InventoryRepository {
3035
return doc ? this.toDomain(doc) : null;
3136
}
3237

33-
async update(id: string, updateData: Partial<Inventory>): Promise<Inventory | null> {
38+
async update(
39+
id: string,
40+
updateData: Partial<Inventory>,
41+
): Promise<Inventory | null> {
3442
const doc = await this.inventoryModel
3543
.findByIdAndUpdate(id, { $set: updateData }, { new: true })
3644
.exec();

backend/src/inventory/infrastructure/schemas/inventory.schema.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ export class InventorySchemaEntity {
1515
location: string;
1616
}
1717

18-
export const InventorySchema = SchemaFactory.createForClass(InventorySchemaEntity);
18+
export const InventorySchema = SchemaFactory.createForClass(
19+
InventorySchemaEntity,
20+
);

backend/src/inventory/inventory.module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { MongooseModule } from '@nestjs/mongoose';
33
import { InventoryService } from './application/inventory.service';
44
import { InventoryController } from './presentation/inventory.controller';
55
import { InventoryRepository } from './infrastructure/repositories/inventory.repository';
6-
import { InventorySchema, InventorySchemaEntity } from './infrastructure/schemas/inventory.schema';
6+
import {
7+
InventorySchema,
8+
InventorySchemaEntity,
9+
} from './infrastructure/schemas/inventory.schema';
710

811
@Module({
912
imports: [

backend/src/inventory/presentation/inventory.controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ export class InventoryController {
3131
}
3232

3333
@Patch(':id')
34-
update(@Param('id') id: string, @Body() updateInventoryDto: UpdateInventoryDto) {
34+
update(
35+
@Param('id') id: string,
36+
@Body() updateInventoryDto: UpdateInventoryDto,
37+
) {
3538
return this.inventoryService.update(id, updateInventoryDto);
3639
}
3740

backend/src/partnership/application/partnership.service.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export class PartnershipService {
1212
return this.partnershipRepository.findAll();
1313
}
1414

15-
async create(createPartnershipDto: CreatePartnershipDto): Promise<Partnership> {
15+
async create(
16+
createPartnershipDto: CreatePartnershipDto,
17+
): Promise<Partnership> {
1618
return this.partnershipRepository.create({
1719
...createPartnershipDto,
1820
status: 'active',
@@ -27,8 +29,14 @@ export class PartnershipService {
2729
return partnership;
2830
}
2931

30-
async update(id: string, updatePartnershipDto: UpdatePartnershipDto): Promise<Partnership> {
31-
const updated = await this.partnershipRepository.update(id, updatePartnershipDto);
32+
async update(
33+
id: string,
34+
updatePartnershipDto: UpdatePartnershipDto,
35+
): Promise<Partnership> {
36+
const updated = await this.partnershipRepository.update(
37+
id,
38+
updatePartnershipDto,
39+
);
3240
if (!updated) {
3341
throw new Error(`Partnership with ID ${id} not found`);
3442
}

backend/src/partnership/infrastructure/repositories/partnership.repository.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { Injectable } from '@nestjs/common';
22
import { InjectModel } from '@nestjs/mongoose';
33
import { Model } from 'mongoose';
44
import { Partnership } from '../../domain/partnership.entity';
5-
import { PartnershipDocument, PartnershipSchemaEntity } from '../schemas/partnership.schema';
5+
import {
6+
PartnershipDocument,
7+
PartnershipSchemaEntity,
8+
} from '../schemas/partnership.schema';
69

710
@Injectable()
811
export class PartnershipRepository {
@@ -16,7 +19,9 @@ export class PartnershipRepository {
1619
return docs.map((doc) => this.toDomain(doc));
1720
}
1821

19-
async create(partnership: Omit<Partnership, 'id' | 'createdAt'>): Promise<Partnership> {
22+
async create(
23+
partnership: Omit<Partnership, 'id' | 'createdAt'>,
24+
): Promise<Partnership> {
2025
const created = new this.partnershipModel(partnership);
2126
const doc = await created.save();
2227
return this.toDomain(doc);
@@ -30,7 +35,10 @@ export class PartnershipRepository {
3035
return doc ? this.toDomain(doc) : null;
3136
}
3237

33-
async update(id: string, updateData: Partial<Partnership>): Promise<Partnership | null> {
38+
async update(
39+
id: string,
40+
updateData: Partial<Partnership>,
41+
): Promise<Partnership | null> {
3442
const doc = await this.partnershipModel
3543
.findByIdAndUpdate(id, { $set: updateData }, { new: true })
3644
.exec();

0 commit comments

Comments
 (0)