clear the testing commits
This commit is contained in:
@@ -11,10 +11,8 @@ RUN npm install -g tsx --ignore-scripts
|
||||
|
||||
COPY package.json ./
|
||||
COPY package-lock.json ./
|
||||
RUN npm install --ignore-scripts
|
||||
|
||||
|
||||
RUN addgroup -S appgroup && \
|
||||
RUN npm install --ignore-scripts && \
|
||||
addgroup -S appgroup && \
|
||||
adduser -S appuser -G appgroup && \
|
||||
chown -R appuser:appgroup /usr/src/app
|
||||
|
||||
|
||||
@@ -537,6 +537,7 @@ router.get("/A_zone/:zoneId/:organization", ZoneService.ZoneData);
|
||||
* example: "Internal Server Error"
|
||||
*/
|
||||
router.patch("/zone/:zoneId", ZoneService.deleteAZone);
|
||||
router.get("/findZones/:organization", ZoneService.getZones);
|
||||
|
||||
router.patch("/zones/lockedPanels", ZoneService.lockedPanel);
|
||||
export default router;
|
||||
|
||||
@@ -20,6 +20,7 @@ export const SignupController = async (
|
||||
return;
|
||||
}
|
||||
const result = await AuthSignup(req.body);
|
||||
console.log('result: ', result);
|
||||
|
||||
switch (result.status) {
|
||||
case "User already exists":
|
||||
|
||||
@@ -72,8 +72,8 @@ export const DeleteZoneController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { organization, userId } = req.user || {};
|
||||
const { zoneId, projectId } = req.body;
|
||||
if (!organization || !userId || !zoneId || !projectId) {
|
||||
const { zoneUuid, projectId } = req.body;
|
||||
if (!organization || !userId || !zoneUuid || !projectId) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -81,7 +81,7 @@ export const DeleteZoneController = async (
|
||||
}
|
||||
const result = await DelZone({
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
@@ -226,8 +226,8 @@ export const ZoneDataController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { organization, userId } = req.user || {};
|
||||
const { projectId, zoneId } = req.params;
|
||||
if (!organization || !userId || !projectId || !zoneId) {
|
||||
const { projectId, zoneUuid } = req.params;
|
||||
if (!organization || !userId || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -237,7 +237,7 @@ export const ZoneDataController = async (
|
||||
organization,
|
||||
projectId,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
});
|
||||
|
||||
switch (result.status) {
|
||||
@@ -277,8 +277,8 @@ export const SingleZonePanelController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { organization, userId } = req.user || {};
|
||||
const { projectId, zoneId } = req.params;
|
||||
if (!organization || !userId || !projectId || !zoneId) {
|
||||
const { projectId, zoneUuid } = req.params;
|
||||
if (!organization || !userId || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -288,7 +288,7 @@ export const SingleZonePanelController = async (
|
||||
organization,
|
||||
projectId,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
});
|
||||
|
||||
switch (result.status) {
|
||||
|
||||
@@ -14,12 +14,12 @@ export const FloatAddController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { widget, zoneId, index, projectId } = req.body;
|
||||
const { widget, zoneUuid, index, projectId } = req.body;
|
||||
if (
|
||||
!userId ||
|
||||
!organization ||
|
||||
!widget ||
|
||||
!zoneId ||
|
||||
!zoneUuid ||
|
||||
!index ||
|
||||
!projectId
|
||||
) {
|
||||
@@ -31,7 +31,7 @@ export const FloatAddController = async (
|
||||
const result = await AddFloat({
|
||||
organization,
|
||||
widget,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
index,
|
||||
projectId,
|
||||
userId,
|
||||
@@ -48,9 +48,9 @@ export const FloatAddController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
message: "Zone not found for the zoneUuid",
|
||||
});
|
||||
break;
|
||||
case "Widget updated successfully":
|
||||
@@ -87,8 +87,8 @@ export const DeleteFloatController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { floatWidgetID, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !floatWidgetID || !projectId || !zoneId) {
|
||||
const { floatWidgetID, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !floatWidgetID || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -97,7 +97,7 @@ export const DeleteFloatController = async (
|
||||
const result = await DelFloat({
|
||||
organization,
|
||||
floatWidgetID,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
@@ -112,9 +112,9 @@ export const DeleteFloatController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
message: "Zone not found for the zoneUuid",
|
||||
});
|
||||
break;
|
||||
case "FloatWidget not found for the Id":
|
||||
@@ -151,13 +151,13 @@ export const DuplicateFloatController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { widget, projectId, zoneId, index } = req.body;
|
||||
const { widget, projectId, zoneUuid, index } = req.body;
|
||||
if (
|
||||
!userId ||
|
||||
!organization ||
|
||||
!widget ||
|
||||
!projectId ||
|
||||
!zoneId ||
|
||||
!zoneUuid ||
|
||||
!index
|
||||
) {
|
||||
res.status(400).json({
|
||||
@@ -168,7 +168,7 @@ export const DuplicateFloatController = async (
|
||||
const result = await DuplicateFloat({
|
||||
organization,
|
||||
widget,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
index,
|
||||
projectId,
|
||||
userId,
|
||||
@@ -184,9 +184,9 @@ export const DuplicateFloatController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
message: "Zone not found for the zoneUuid",
|
||||
});
|
||||
break;
|
||||
case "FloatWidget update unsuccessfull":
|
||||
@@ -228,8 +228,8 @@ export const GetFloatController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { projectId, zoneId } = req.params;
|
||||
if (!userId || !organization || !projectId || !zoneId) {
|
||||
const { projectId, zoneUuid } = req.params;
|
||||
if (!userId || !organization || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -237,7 +237,7 @@ export const GetFloatController = async (
|
||||
}
|
||||
const result = await GetFloatWidget({
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
|
||||
@@ -13,8 +13,8 @@ export const AddPanelController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { panelOrder, zoneId, projectId } = req.body;
|
||||
if (!userId || !organization || !panelOrder || !zoneId || !projectId) {
|
||||
const { panelOrder, zoneUuid, projectId } = req.body;
|
||||
if (!userId || !organization || !panelOrder || !zoneUuid || !projectId) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -23,7 +23,7 @@ export const AddPanelController = async (
|
||||
const result = await AddPanel({
|
||||
organization,
|
||||
panelOrder,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
@@ -74,8 +74,8 @@ export const DeletePanelController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { panelName, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !panelName || !projectId || !zoneId) {
|
||||
const { panelName, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !panelName || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -84,7 +84,7 @@ export const DeletePanelController = async (
|
||||
const result = await DelPanel({
|
||||
organization,
|
||||
panelName,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
@@ -133,8 +133,8 @@ export const ClearPanelController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { panelName, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !panelName || !projectId || !zoneId) {
|
||||
const { panelName, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !panelName || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -143,7 +143,7 @@ export const ClearPanelController = async (
|
||||
const result = await ClearPanel({
|
||||
organization,
|
||||
panelName,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
@@ -197,8 +197,8 @@ export const LockedPanelController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { projectId, zoneId, lockedPanel } = req.body;
|
||||
if (!userId || !organization || !projectId || !zoneId || !lockedPanel) {
|
||||
const { projectId, zoneUuid, lockedPanel } = req.body;
|
||||
if (!userId || !organization || !projectId || !zoneUuid || !lockedPanel) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -206,7 +206,7 @@ export const LockedPanelController = async (
|
||||
}
|
||||
const result = await LockedPanel({
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
lockedPanel,
|
||||
userId,
|
||||
projectId,
|
||||
|
||||
@@ -72,8 +72,8 @@ export const AddTemToZoneController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { templateID, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !templateID || !projectId || !zoneId) {
|
||||
const { templateID, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !templateID || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -82,7 +82,7 @@ export const AddTemToZoneController = async (
|
||||
const result = await AddTemplateToZone({
|
||||
organization,
|
||||
templateID,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
|
||||
@@ -13,8 +13,8 @@ export const AddWidgetController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { widget, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !widget || !projectId || !zoneId) {
|
||||
const { widget, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !widget || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -25,7 +25,7 @@ export const AddWidgetController = async (
|
||||
widget,
|
||||
projectId,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
});
|
||||
|
||||
switch (result.status) {
|
||||
@@ -39,7 +39,7 @@ export const AddWidgetController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
});
|
||||
@@ -88,8 +88,8 @@ export const WidgetDeleteController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { widgetID, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !widgetID || !projectId || !zoneId) {
|
||||
const { widgetID, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !widgetID || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -98,7 +98,7 @@ export const WidgetDeleteController = async (
|
||||
const result = await WidgetDelete({
|
||||
organization,
|
||||
widgetID,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
userId,
|
||||
});
|
||||
@@ -113,9 +113,9 @@ export const WidgetDeleteController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
message: "Zone not found for the zoneUuid",
|
||||
});
|
||||
break;
|
||||
case "Widget not found":
|
||||
@@ -147,14 +147,14 @@ export const WidgetUpdateController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { values, projectId, zoneId, widgetID } = req.body;
|
||||
const { values, projectId, zoneUuid, widgetID } = req.body;
|
||||
if (
|
||||
!userId ||
|
||||
!organization ||
|
||||
!widgetID ||
|
||||
!values ||
|
||||
!projectId ||
|
||||
!zoneId
|
||||
!zoneUuid
|
||||
) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
@@ -164,7 +164,7 @@ export const WidgetUpdateController = async (
|
||||
const result = await UpdateWidget({
|
||||
organization,
|
||||
values,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
widgetID,
|
||||
projectId,
|
||||
userId,
|
||||
@@ -180,9 +180,9 @@ export const WidgetUpdateController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
message: "Zone not found for the zoneUuid",
|
||||
});
|
||||
break;
|
||||
case "Data not found":
|
||||
@@ -214,12 +214,12 @@ export const GetWidgetController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { projectId, zoneId, widgetID } = req.query as {
|
||||
const { projectId, zoneUuid, widgetID } = req.query as {
|
||||
projectId: string;
|
||||
zoneId: string;
|
||||
zoneUuid: string;
|
||||
widgetID: string;
|
||||
};
|
||||
if (!userId || !organization || !widgetID || !projectId || !zoneId) {
|
||||
if (!userId || !organization || !widgetID || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -227,7 +227,7 @@ export const GetWidgetController = async (
|
||||
}
|
||||
const result = await GetWidget({
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
widgetID,
|
||||
projectId,
|
||||
userId,
|
||||
@@ -243,9 +243,9 @@ export const GetWidgetController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
message: "Zone not found for the zoneUuid",
|
||||
});
|
||||
break;
|
||||
case "Widget not found for the widgetID":
|
||||
|
||||
@@ -13,8 +13,8 @@ export const Add3dWidgetController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { widget, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !widget || !projectId || !zoneId) {
|
||||
const { widget, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !widget || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -24,7 +24,7 @@ export const Add3dWidgetController = async (
|
||||
organization,
|
||||
widget,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ export const Add3dWidgetController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
case "Zone not found for the zoneUuid":
|
||||
res.status(200).json({
|
||||
message: "Zone not found",
|
||||
});
|
||||
@@ -83,7 +83,7 @@ export const Update3DwidgetController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { id, position, rotation, projectId, zoneId } = req.body;
|
||||
const { id, position, rotation, projectId, zoneUuid } = req.body;
|
||||
if (
|
||||
!userId ||
|
||||
!organization ||
|
||||
@@ -91,7 +91,7 @@ export const Update3DwidgetController = async (
|
||||
!position ||
|
||||
!rotation ||
|
||||
!projectId ||
|
||||
!zoneId
|
||||
!zoneUuid
|
||||
) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
@@ -104,7 +104,7 @@ export const Update3DwidgetController = async (
|
||||
position,
|
||||
rotation,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
});
|
||||
switch (result.status) {
|
||||
@@ -157,8 +157,8 @@ export const Delete3DwidgetController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { id, projectId, zoneId } = req.body;
|
||||
if (!userId || !organization || !id || !projectId || !zoneId) {
|
||||
const { id, projectId, zoneUuid } = req.body;
|
||||
if (!userId || !organization || !id || !projectId || !zoneUuid) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -168,7 +168,7 @@ export const Delete3DwidgetController = async (
|
||||
organization,
|
||||
id,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
});
|
||||
switch (result.status) {
|
||||
@@ -221,7 +221,7 @@ export const Get3DWidgetController = async (
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { projectId, zoneId } = req.params;
|
||||
const { projectId, zoneUuid } = req.params;
|
||||
if (!userId || !organization || !projectId) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
@@ -231,7 +231,7 @@ export const Get3DWidgetController = async (
|
||||
const result = await Get3Dwidget({
|
||||
organization,
|
||||
userId,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId,
|
||||
});
|
||||
switch (result.status) {
|
||||
|
||||
@@ -29,12 +29,12 @@ v1Zone.get(
|
||||
);
|
||||
|
||||
v1Zone.get(
|
||||
"/zones/:projectId/:zoneId",
|
||||
"/zones/:projectId/:zoneUuid",
|
||||
tokenValidator,
|
||||
ZoneDataController
|
||||
);
|
||||
v1Zone.get(
|
||||
"/zones/panel/:projectId/:zoneId",
|
||||
"/zones/panel/:projectId/:zoneUuid",
|
||||
tokenValidator,
|
||||
SingleZonePanelController
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ v1FloatWidget.patch(
|
||||
DeleteFloatController
|
||||
);
|
||||
v1FloatWidget.get(
|
||||
"/floatWidgets/:zoneId/:projectId",
|
||||
"/floatWidgets/:zoneUuid/:projectId",
|
||||
tokenValidator,
|
||||
GetFloatController
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@ v1Widget3d.patch(
|
||||
Update3DwidgetController
|
||||
);
|
||||
v1Widget3d.get(
|
||||
"/widget3d/data/:zoneId/:projectId",
|
||||
"/widget3d/data/:zoneUuid/:projectId",
|
||||
tokenValidator,
|
||||
Get3DWidgetController
|
||||
);
|
||||
|
||||
@@ -238,7 +238,25 @@ export class ZoneService {
|
||||
return res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
static async getZones(req: Request, res: Response) {
|
||||
try {
|
||||
const { organization } = req.params;
|
||||
|
||||
const findZoneId = await zoneSchema(organization)
|
||||
.find({isArchive:false})
|
||||
.select(
|
||||
"zoneId zoneName layer points viewPortCenter viewPortposition -_id"
|
||||
);
|
||||
|
||||
if (!findZoneId) {
|
||||
res.status(500).json({ message: "Invalid zone" });
|
||||
}
|
||||
res.status(201).json({ data: findZoneId, organization: organization });
|
||||
} catch (error) {
|
||||
console.log("error: ", error);
|
||||
res.status(500).json({ message: "Zone not found", error });
|
||||
}
|
||||
}
|
||||
static async lockedPanel(req: Request, res: Response): Promise<any> {
|
||||
console.log(req.body);
|
||||
const organization = req.body.organization;
|
||||
|
||||
Reference in New Issue
Block a user