Skip to content

Commit

Permalink
more efficient search and tags with updated firestore rules
Browse files Browse the repository at this point in the history
  • Loading branch information
osamahahmad committed Feb 18, 2025
1 parent ddf602d commit 392746c
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 189 deletions.
2 changes: 1 addition & 1 deletion firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rules_version = '2';

service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId}/{document=**} {
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/components/QuestionBankItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import { db } from '../resources/Firebase.js';
import ColouredChip from './ColouredChip.tsx';

interface QuestionBankItemProps {
id?: string;
data?: ParsedQuestionBank;
progress?: ColorPaletteProp;
currentTags?: string[];
setCurrentTags?: Function;
id: string;
tags: string[];
data: ParsedQuestionBank;
progress: ColorPaletteProp;
currentTags: string[];
setCurrentTags: Function;
};

const QuestionBankItem: FC<QuestionBankItemProps> = ({ id, data, progress, currentTags, setCurrentTags }) => {
const QuestionBankItem: FC<QuestionBankItemProps> = ({ id, tags, data, progress, currentTags, setCurrentTags }) => {
const authentication = useAuthentication();

const tags: string[] = (data && data.hasOwnProperty('tags')) ? data['tags'] : undefined;
const title = (data && data.hasOwnProperty('title')) ? data['title'] : undefined;
const content = (data && data.hasOwnProperty('content')) ? data['content'] : undefined;
const answer = (data && data.hasOwnProperty('Answer')) ? data['Answer'] : undefined;
const rationale = (data && data.hasOwnProperty('Rationale')) ? data['Rationale'] : undefined;
const title = data.hasOwnProperty('title') ? data['title'] : undefined;
const content = data.hasOwnProperty('content') ? data['content'] : undefined;
const answer = data.hasOwnProperty('Answer') ? data['Answer'] : undefined;
const rationale = data.hasOwnProperty('Rationale') ? data['Rationale'] : undefined;

const [_progress, _setProgress] = useState<ColorPaletteProp>(progress || 'neutral');

Expand Down
Loading

0 comments on commit 392746c

Please sign in to comment.