# Activity Logs
---
# Tables
## activity_logs
### columns:
- action_type (string)
+ contoh: rfq_created, rfq_cancelled
- content (jsonb)
```
{
// Markdown format
"en": "*Printing Jaya* _accepted_ *Pearly Adi Negoro*'s invitation",
"en": "*Pearly Adi Negoro* Added Design URL [Filename 1](URL), [Filename 2](URL) for Item \"Kartu Nama Marketing\""
}
```
- link
+ /rfq/123/view
+ /items/111
- subject_type (contoh: Partner | Organization)
- subject_id
- user_id (optional)
- time
- resources (jsonb)
```
[
{
type: "Phoenix::Inquiry"
id: ID
},
Phoenix::Inquiry.find(1)
]
```
- deleted_at
- created_at
- updated_at
## activity_log_tags
### columns:
- code
- name
- active_at
- inactive_at
## activity_log_taggables
- activity_log_id
- activity_log_tag_id
# Logic
- action_type => Action type
- tags => Show at
- content => Activity Log
- resources => object yg dibutuhkan di content
```json=
{
"action_type":"rfq_approved",
"number": "RFQ7659789",
"user": "John Doe",
//optional
"total": "4566756",
// optional untuk files
"attachments":[{
"file_name": "kartu.jpg",
"file_link": "https://"
}]
}
// base response
{
"type": "rfq_approved",
"created_at": date,
"user_id": 1, // if nil by system
"user": {"user data"},
"resource_id": 1,
"partner_id": nullable,
"partner": {"partner data"}
"content": {
"link": "URL",
"value": "Business Card Marketing",
"old_value": "Business Card"
"additional": [{}], // gray text
"attachments": [{}] // link
},
}
// Item Created
{
"content": {
"link": "url",
"value": "Business Card Marketing",
},
}
// Rfq Approved
//
"content": {
"link": "url",
"value": "RFQNUMBER",
"old_value": "",
"additional": "10000", // gray text
"additional_type": "price",
},
// File Uploaded
"content": {
"attachments": [{
"file_name": "busines_card.jpg",
"file_url": "URL"
}] // link
},
// File Name Change
"content": {
"value": "Business_Card_Marketing.jpg",
"old_value": "Business_Card.jpg"
},
// New Supplier Added
// {partner_name} add to {content_value} by {user}
// Automatically add as {partner_name} submits on {additional_value} link {addional_type: :additional_id}
"content": {
"link": "URL",
"value": "Business Card",
"additional": [{
"type": "quotation", // rfq/:id
"id": 1,
"value": "RFQ_NUMBER"
}],
},
```
// alternative
```json=
{
"partner": {
"name": "iLitho"
}
"inquiry": {
"id": 1,
"name": "Business Card Staff.pdf",
"number": "RFQ/1123/OCM9"
}
}
// Quotation submitted by Supplier
// {partner_name} submit quotation for {content_value} {additional_value} link{additional_type: :additional_id}
"content": {
"link": "URL",
"value": "RFQ000",
"additional": [{
"type": "Quotaion_download", // rfq/:id
"id": 1,
"value": "CQT000"
}],
},
```
```json=
[{
"resource_id": ID,
"resource_type": "rfq",
"content": {
"action_type":"rfq_aapproved",
"description":{
"title":"RFQ7659789",
"action":"approved",
"user_name": "John Doe"
}
//optional
"additonal": {
"text": "456456",
"type": "price_total"
}
// optional untuk files
"attachments":[{
"file_name": "kartu.jpg",
"file_link": "https://"
}]
},
"user_id": ID,
"created_at": DATETIME,
"updated_at": DATETIME
}]
```
```json=
```