# Paintbox

---
## Demo [Asmahan]
[Vercel](https://paintbox-app.vercel.app/)
[Supabase](https://app.supabase.com/project/ulyfxolrzuillykporhl/editor/17629)
---
## QA [Hallie]

---

---
Jest🧐, Playwright😅, Cypress🤗, PGtap🥸?

---
## UX/UI Lead [Peter]
- As a team I felt that really worked well with one another, implementing functionality.
- What I learnt was styled-components, styled-components utilises tagged template literals to style your components. It removes the mapping between components and styles. This means that when you're defining your styles, you're actually creating a normal React component, that has your styles attached to it.
---

---
## Devops [Petra]
---
### Supabase
**No, it's not 🚫**

---
* Secure data
* RLP (row level security)
* Postgres Policies
```
ALTER TABLE arts ENABLE ROW LEVEL SECURITY;
```
```
CREATE POLICY
"Can only view data if logged in."
ON public.arts
FOR SELECT
USING ( auth.uid() = user_id );
```
---
* Protected routes
```
export async function getServerSideProps({ req }) {
/* check to see if a user is set */
const { user } = await supabase.auth.api.getUserByCookie(req);
/* if no user is set, redirect to the login page */
if (!user) {
return { props: {}, redirect: { destination: "/" } };
}
/* if a user is set, pass it to the page via props */
return { props: { user } };
}
```
---
* PSQL function
```
create function increment (x int, mood_name text)
returns void as
$$
update moods
set count = count + x
where mood = mood_name
$$
language sql volatile;
```
---
* Easy Supabase syntax
```
async function addArtDataHandler(inputs) {
setMoodInput(inputs.mood);
const { data, error } = await supabase
.from("arts")
.insert([
{
mood: inputs.mood,
user_id: sessionId.user.id,
alt: inputs.alt,
caption: inputs.caption,
public: inputs.public,
prompt: inputs.prompt,
img: inputs.img,
email: sessionId.user.email,
},
])
.then((data) => {
return data;
});
```
---
## Scrum Facilitator [ Asmahan]
- More time is required when working with a new library (Jest & ChatEngine)
- (Chat Engine is an API which makes it easy to build chat services)
- Testing is fun!

___
{"metaMigratedAt":"2023-06-17T04:01:43.875Z","metaMigratedFrom":"Content","title":"Paintbox","breaks":true,"contributors":"[{\"id\":\"b0e38993-dfe4-4d11-a36f-4911acc7a482\",\"add\":1517,\"del\":1808},{\"id\":\"72828aeb-1e38-4d75-8997-7322d21f5a7f\",\"add\":763,\"del\":151},{\"id\":\"09037c59-717e-4307-a771-2d97a9c811fe\",\"add\":657,\"del\":72},{\"id\":\"ff9685a5-938d-4f95-a437-1e0b44c8f4a5\",\"add\":1848,\"del\":82}]"}