Merge pull request #211 from DeimosPr4/UH-listaInvitadosGuarda
Pantallas guarda de seguridad
This commit is contained in:
commit
e035df8a0c
|
@ -433,6 +433,12 @@ export class AppController {
|
|||
findGuestUser(@Param('id') paramGuestId: string) {
|
||||
return this.appService.findGuestUser(paramGuestId);
|
||||
}
|
||||
|
||||
@Get('guest/findGuestCommunity/:id')
|
||||
findGuestCommunityr(@Param('id') paramGuestId: string) {
|
||||
return this.appService.findGuestCommunityr(paramGuestId);
|
||||
}
|
||||
|
||||
@Post('guest/updateGuest')
|
||||
updateGuest(
|
||||
@Body('_id') _id: string){
|
||||
|
@ -523,7 +529,10 @@ export class AppController {
|
|||
allPosts() {
|
||||
return this.appService.allPosts();
|
||||
}
|
||||
|
||||
@Get('post/findPostCommunity/:id')
|
||||
findPostCommunity(@Param('id') paramPost: string) {
|
||||
return this.appService.findPostCommunity(paramPost);
|
||||
}
|
||||
@Get('post/find/:id')
|
||||
findPost(@Param('id') paramPost: string) {
|
||||
return this.appService.findPost(paramPost);
|
||||
|
|
|
@ -549,6 +549,14 @@ export class AppService {
|
|||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
findGuestCommunityr(paramGuestId: string) {
|
||||
const pattern = { cmd: 'findGuestCommunity' };
|
||||
const payload = { id: paramGuestId };
|
||||
return this.clientGuestApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
updateGuest(_id: string
|
||||
) {
|
||||
const pattern = { cmd: 'removeGuest' };
|
||||
|
@ -655,6 +663,14 @@ export class AppService {
|
|||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
findPostCommunity(paramGuestId: string) {
|
||||
const pattern = { cmd: 'findPostCommunity' };
|
||||
const payload = { id: paramGuestId };
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
findPost(paramPostId: string) {
|
||||
const pattern = { cmd: 'findOnePost' };
|
||||
|
|
|
@ -8,8 +8,8 @@ import PropTypes from 'prop-types';
|
|||
|
||||
import React from 'react';
|
||||
|
||||
export const CommentCard = ({ date, comment }) => {
|
||||
const dateFormated = format(new Date(date), "dd LL yyyy")
|
||||
export const CommentCard = ({ post }) => {
|
||||
//const dateFormated = format(new Date(date), "dd LL yyyy")
|
||||
return (
|
||||
<Pressable
|
||||
rounded="8"
|
||||
|
@ -31,14 +31,14 @@ export const CommentCard = ({ date, comment }) => {
|
|||
</Badge>
|
||||
<Spacer />
|
||||
<Text fontSize={10} color="coolGray.800">
|
||||
{dateFormated}
|
||||
|
||||
</Text>
|
||||
</HStack>
|
||||
<Text color="coolGray.800" mt="3" fontWeight="medium" fontSize="xl">
|
||||
Administrador de Comunidad
|
||||
</Text>
|
||||
<Text mt="2" fontSize="sm" color="coolGray.700">
|
||||
{comment}
|
||||
{post}
|
||||
</Text>
|
||||
</Box>
|
||||
</Pressable>
|
||||
|
@ -46,6 +46,6 @@ export const CommentCard = ({ date, comment }) => {
|
|||
}
|
||||
|
||||
CommentCard.propTypes = {
|
||||
date: PropTypes.string.isRequired,
|
||||
comment: PropTypes.string.isRequired,
|
||||
// date: PropTypes.string.isRequired,
|
||||
post: PropTypes.string.isRequired,
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@ export default function Home() {
|
|||
const { user } = useContext(UserContext)
|
||||
const [isRequesting, setIsRequesting] = useState(false);
|
||||
const [comments, setComments] = useState([]);
|
||||
|
||||
const user_type=user.user_type;
|
||||
//const user_type="4";
|
||||
const community_id=user.community_id;
|
||||
//const community_id="1";
|
||||
useEffect(() => {
|
||||
|
||||
console.log(user);
|
||||
|
@ -17,7 +20,18 @@ export default function Home() {
|
|||
setIsRequesting(true);
|
||||
|
||||
try {
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/post/allComments`, {
|
||||
if(user_type=="4"){
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/post/findPostCommunity/`+`${community_id}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
const response = await jsonResponse.json();
|
||||
setComments(response.message);
|
||||
|
||||
}else{
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/post/allPosts`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
@ -25,9 +39,8 @@ export default function Home() {
|
|||
})
|
||||
|
||||
const response = await jsonResponse.json();
|
||||
// console.log(response);
|
||||
|
||||
setComments(response.message);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
|
@ -55,8 +68,8 @@ export default function Home() {
|
|||
comments.map(item => (
|
||||
<CommentCard
|
||||
key={item._id}
|
||||
comment={item.comment}
|
||||
date={item.date_entry}
|
||||
post={item.post}
|
||||
//date={date}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
|
|
@ -15,6 +15,10 @@ export default function Invitados({navigation}) {
|
|||
const { user } = useContext(UserContext);
|
||||
const id = user._id;
|
||||
//const id = "6301df20dac7dcf76dcecade";
|
||||
const user_type=user.user_type;
|
||||
//const user_type="4";
|
||||
//const community_id="1";
|
||||
const community_id=user.community_id;
|
||||
const [invitado, setInvitado] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -23,6 +27,17 @@ export default function Invitados({navigation}) {
|
|||
setIsRequesting(true);
|
||||
|
||||
try {
|
||||
if(user_type=="4"){
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/guest/findGuestCommunity/`+`${community_id}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
const response = await jsonResponse.json();
|
||||
setInvitados(response.message);
|
||||
}else{
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/guest/findGuestUser/`+`${id}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
@ -31,9 +46,8 @@ export default function Invitados({navigation}) {
|
|||
})
|
||||
|
||||
const response = await jsonResponse.json();
|
||||
//console.log(response);
|
||||
setInvitados(response.message);
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
@ -118,13 +132,9 @@ export default function Invitados({navigation}) {
|
|||
|
||||
</VStack>
|
||||
<Spacer />
|
||||
<MaterialCommunityIcons name="delete" size={28} color="#7C0808" onPress={() =>{deleteInvitado(item._id)}} />
|
||||
{user_type == 3 && <MaterialCommunityIcons name="delete" size={28} color="#7C0808" onPress={() =>{deleteInvitado(item._id)}} />}
|
||||
</HStack>
|
||||
</Box>} keyExtractor={item => item.id} />
|
||||
|
||||
|
||||
|
||||
|
||||
</Box>
|
||||
|
||||
|
||||
|
|
|
@ -33,4 +33,10 @@ export class PostCommentsController {
|
|||
let _id = id['id'];
|
||||
return this.postCommentsService.remove(_id);
|
||||
}
|
||||
|
||||
@MessagePattern({ cmd: 'findCommentCommunity' })
|
||||
findPostCommunity(@Payload() id: string) {
|
||||
let _id = id['id'];
|
||||
return this.postCommentsService.findPostCommunity(_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,4 +37,9 @@ export class PostCommentsService {
|
|||
new: true,
|
||||
});
|
||||
}
|
||||
|
||||
async findPostCommunity(id: string): Promise<Comment[]> {
|
||||
console.log(id);
|
||||
return this.commentModel.find({community_id:id}).setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,4 +33,9 @@ export class PostsController {
|
|||
let _id = id['id'];
|
||||
return this.postsService.remove(_id);
|
||||
}
|
||||
@MessagePattern({ cmd: 'findPostCommunity' })
|
||||
findPostCommunity(@Payload() id: string) {
|
||||
let _id = id['id'];
|
||||
return this.postsService.findPostCommunity(_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ export class PostsService {
|
|||
async remove(id: string) {
|
||||
return this.postModel.findByIdAndRemove({ _id: id }).exec();
|
||||
}
|
||||
|
||||
async findPostCommunity(id: string): Promise<Post[]> {
|
||||
console.log(id);
|
||||
return this.postModel.find({community_id:id}).setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,11 @@ export class GuestsController {
|
|||
findGuestUser(@Payload() id: string) {
|
||||
return this.guestsService.findGuestUser(id);
|
||||
}
|
||||
@MessagePattern({ cmd: 'findGuestCommunity' })
|
||||
findGuestCommunity(@Payload() id: string) {
|
||||
let _id = id['id'];
|
||||
return this.guestsService.findGuestCommunity(_id);
|
||||
}
|
||||
@MessagePattern({ cmd: 'findOneGuest' })
|
||||
findOneById(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
|
|
|
@ -18,10 +18,14 @@ export class GuestsService {
|
|||
}
|
||||
|
||||
async findGuestUser(id: string): Promise<Guest[]> {
|
||||
console.log(id);
|
||||
return this.guestModel.find({_tenant_id:id, status:"1"}).setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
async findGuestCommunity(id: string): Promise<Guest[]> {
|
||||
console.log(id);
|
||||
return this.guestModel.find({community_id:id}).setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
findOneId(id: string): Promise<Guest> {
|
||||
return this.guestModel.findOne({ _id: id }).exec();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue