fix conflict

This commit is contained in:
Maria Sanchez 2022-08-31 22:17:47 -06:00
commit 669a28bed3
7 changed files with 31 additions and 7 deletions

View File

@ -654,4 +654,10 @@ export class AppController {
html(@Body('email') email: string, @Body('name') name: string) { html(@Body('email') email: string, @Body('name') name: string) {
return this.appService.html(email, name); return this.appService.html(email, name);
} }
@Get('reservation/findReservationUser/:id')
findReservationUser(@Param('id') paramComment: string) {
return this.appService.findReservationUser(paramComment);
}
} }

View File

@ -823,8 +823,6 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
/* Function to generate combination of password */ /* Function to generate combination of password */
generatePassword() { generatePassword() {
var pass = ''; var pass = '';
@ -841,8 +839,6 @@ export class AppService {
return pass; return pass;
} }
async saveTenantNumHouse(community_id: string, number_house: string, tenant_id: string) { async saveTenantNumHouse(community_id: string, number_house: string, tenant_id: string) {
const pattern = { cmd: 'saveTenantNumHouse' } const pattern = { cmd: 'saveTenantNumHouse' }
@ -855,4 +851,13 @@ export class AppService {
) )
} }
findReservationUser(paramGuestId: string) {
const pattern = { cmd: 'findReservationUser' };
const payload = { id: paramGuestId };
return this.clientReservationApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
} }

View File

@ -72,7 +72,7 @@ export default function App() {
<UserContextProvider> <UserContextProvider>
<NavigationContainer> <NavigationContainer>
<Stack.Navigator initialRouteName="LogIn"> <Stack.Navigator initialRouteName="LogIn">
<Stack.Screen name="Inicio" component={LogIn} options={{ <Stack.Screen name="Inicio" component={Reservas} options={{
headerStyle: { headerStyle: {
backgroundColor: "#D7A86E" backgroundColor: "#D7A86E"
} }

View File

@ -18,6 +18,8 @@ export default function Reservas({navigation}) {
const { user } = useContext(UserContext) const { user } = useContext(UserContext)
const [isRequesting, setIsRequesting] = useState(false); const [isRequesting, setIsRequesting] = useState(false);
const [reservas, setReservas] = useState([]); const [reservas, setReservas] = useState([]);
const id = user._id;
//const id = "6301df20dac7dcf76dcecade";
useEffect(() => { useEffect(() => {
@ -26,7 +28,7 @@ export default function Reservas({navigation}) {
setIsRequesting(true); setIsRequesting(true);
try { try {
const jsonResponse = await fetch(`${API.BASE_URL}/reservation/allReservations`, { const jsonResponse = await fetch(`${API.BASE_URL}/reservation/findReservationUser/`+`${id}`, {
method: "GET", method: "GET",
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@ -5,7 +5,6 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "servicio-reservaciones",
"version": "0.0.1", "version": "0.0.1",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {

View File

@ -50,4 +50,11 @@ export class ReservationsController {
let community_id = reservation['community_id']; let community_id = reservation['community_id'];
return this.reservationsService.removeIdCommunity(community_id); return this.reservationsService.removeIdCommunity(community_id);
} }
@MessagePattern({ cmd: 'findReservationUser' })
findReservationUser(@Payload() id: string) {
let _id = id['id'];
return this.reservationsService.findReservationUser(_id);
}
} }

View File

@ -52,4 +52,9 @@ export class ReservationsService {
async findReservationsByCommunity(community_id: string){ async findReservationsByCommunity(community_id: string){
return this.reservationModel.find({ community_id: community_id }).exec(); return this.reservationModel.find({ community_id: community_id }).exec();
} }
async findReservationUser(id: string): Promise<Reservation[]> {
return this.reservationModel.find({user_id:id}).setOptions({ sanitizeFilter: true }).exec();
}
} }